In certain situations it's useful to be able to write to an offset of the mapping. Add a dst_offset to iosys_map_memcpy_to().
Showing the changes to include (1 of 3 files). Show all
Unified · Split
| @@ -220,22 +220,23 @@ static inline void iosys_map_clear(struct iosys_map *map) · 219 unmodified lines | |||
| 220 | } | 220 | } |
| 221 | 221 | ||
| 222 | /** | 222 | /** |
| 223 | * iosys_map_memcpy_to - Memcpy into iosys mapping | 223 | * iosys_map_memcpy_to - Memcpy into offset of iosys_map |
| 224 | * @dst: The iosys_map structure | 224 | * @dst: The iosys_map structure |
| 225 | * @dst_offset: The offset from which to copy | ||
| 225 | * @src: The source buffer | 226 | * @src: The source buffer |
| 226 | * @len: The number of byte in src | 227 | * @len: The number of byte in src |
| 227 | * | 228 | * |
| 228 | * Copies data into a iosys mapping. The source buffer is in system | 229 | * Copies data into a iosys_map with an offset. The source buffer is in |
| 229 | * memory. Depending on the buffer's location, the helper picks the correct | 230 | * system memory. Depending on the buffer's location, the helper picks the |
| 230 | * method of accessing the memory. | 231 | * correct method of accessing the memory. |
| 231 | */ | 232 | */ |
| 232 | static inline void iosys_map_memcpy_to(struct iosys_map *dst, const void *src, | 233 | static inline void iosys_map_memcpy_to(struct iosys_map *dst, size_t dst_offset, |
| 233 | size_t len) | 234 | const void *src, size_t len) |
| 234 | { | 235 | { |
| 235 | if (dst->is_iomem) | 236 | if (dst->is_iomem) |
| 236 | memcpy_toio(dst->vaddr_iomem, src, len); | 237 | memcpy_toio(dst->vaddr_iomem + dst_offset, src, len); |
| 237 | else | 238 | else |
| 238 | memcpy(dst->vaddr, src, len); | 239 | memcpy(dst->vaddr + dst_offset, src, len); |
| 239 | } | 240 | } |
| 240 | 241 | ||
| 241 | /** | 242 | /** |