diff options
-rw-r--r-- | arch/arm/common/dmabounce.c | 7 | ||||
-rw-r--r-- | arch/arm/mm/consistent.c | 13 | ||||
-rw-r--r-- | include/asm-arm/cacheflush.h | 12 | ||||
-rw-r--r-- | include/asm-arm/dma-mapping.h | 2 |
4 files changed, 16 insertions, 18 deletions
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c index b4748e3171c6..2362c498f52e 100644 --- a/arch/arm/common/dmabounce.c +++ b/arch/arm/common/dmabounce.c | |||
@@ -321,12 +321,12 @@ unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | |||
321 | DO_STATS ( device_info->bounce_count++ ); | 321 | DO_STATS ( device_info->bounce_count++ ); |
322 | 322 | ||
323 | if (dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL) { | 323 | if (dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL) { |
324 | unsigned long ptr; | 324 | void *ptr = buf->ptr; |
325 | 325 | ||
326 | dev_dbg(dev, | 326 | dev_dbg(dev, |
327 | "%s: copy back safe %p to unsafe %p size %d\n", | 327 | "%s: copy back safe %p to unsafe %p size %d\n", |
328 | __func__, buf->safe, buf->ptr, size); | 328 | __func__, buf->safe, ptr, size); |
329 | memcpy(buf->ptr, buf->safe, size); | 329 | memcpy(ptr, buf->safe, size); |
330 | 330 | ||
331 | /* | 331 | /* |
332 | * DMA buffers must have the same cache properties | 332 | * DMA buffers must have the same cache properties |
@@ -336,7 +336,6 @@ unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, | |||
336 | * bidirectional case because we know the cache | 336 | * bidirectional case because we know the cache |
337 | * lines will be coherent with the data written. | 337 | * lines will be coherent with the data written. |
338 | */ | 338 | */ |
339 | ptr = (unsigned long)buf->ptr; | ||
340 | dmac_clean_range(ptr, ptr + size); | 339 | dmac_clean_range(ptr, ptr + size); |
341 | outer_clean_range(__pa(ptr), __pa(ptr) + size); | 340 | outer_clean_range(__pa(ptr), __pa(ptr) + size); |
342 | } | 341 | } |
diff --git a/arch/arm/mm/consistent.c b/arch/arm/mm/consistent.c index 83bd035c7d5e..166aee13c4b1 100644 --- a/arch/arm/mm/consistent.c +++ b/arch/arm/mm/consistent.c | |||
@@ -205,10 +205,10 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp, | |||
205 | * kernel direct-mapped region for device DMA. | 205 | * kernel direct-mapped region for device DMA. |
206 | */ | 206 | */ |
207 | { | 207 | { |
208 | unsigned long kaddr = (unsigned long)page_address(page); | 208 | void *ptr = page_address(page); |
209 | memset(page_address(page), 0, size); | 209 | memset(ptr, 0, size); |
210 | dmac_flush_range(kaddr, kaddr + size); | 210 | dmac_flush_range(ptr, ptr + size); |
211 | outer_flush_range(__pa(kaddr), __pa(kaddr) + size); | 211 | outer_flush_range(__pa(ptr), __pa(ptr) + size); |
212 | } | 212 | } |
213 | 213 | ||
214 | /* | 214 | /* |
@@ -481,10 +481,9 @@ core_initcall(consistent_init); | |||
481 | * platforms with CONFIG_DMABOUNCE. | 481 | * platforms with CONFIG_DMABOUNCE. |
482 | * Use the driver DMA support - see dma-mapping.h (dma_sync_*) | 482 | * Use the driver DMA support - see dma-mapping.h (dma_sync_*) |
483 | */ | 483 | */ |
484 | void consistent_sync(void *vaddr, size_t size, int direction) | 484 | void consistent_sync(const void *start, size_t size, int direction) |
485 | { | 485 | { |
486 | unsigned long start = (unsigned long)vaddr; | 486 | const void *end = start + size; |
487 | unsigned long end = start + size; | ||
488 | 487 | ||
489 | BUG_ON(!virt_addr_valid(start) || !virt_addr_valid(end)); | 488 | BUG_ON(!virt_addr_valid(start) || !virt_addr_valid(end)); |
490 | 489 | ||
diff --git a/include/asm-arm/cacheflush.h b/include/asm-arm/cacheflush.h index ce60b3702ba5..afad32c76e6c 100644 --- a/include/asm-arm/cacheflush.h +++ b/include/asm-arm/cacheflush.h | |||
@@ -185,9 +185,9 @@ struct cpu_cache_fns { | |||
185 | void (*coherent_user_range)(unsigned long, unsigned long); | 185 | void (*coherent_user_range)(unsigned long, unsigned long); |
186 | void (*flush_kern_dcache_page)(void *); | 186 | void (*flush_kern_dcache_page)(void *); |
187 | 187 | ||
188 | void (*dma_inv_range)(unsigned long, unsigned long); | 188 | void (*dma_inv_range)(const void *, const void *); |
189 | void (*dma_clean_range)(unsigned long, unsigned long); | 189 | void (*dma_clean_range)(const void *, const void *); |
190 | void (*dma_flush_range)(unsigned long, unsigned long); | 190 | void (*dma_flush_range)(const void *, const void *); |
191 | }; | 191 | }; |
192 | 192 | ||
193 | struct outer_cache_fns { | 193 | struct outer_cache_fns { |
@@ -246,9 +246,9 @@ extern void __cpuc_flush_dcache_page(void *); | |||
246 | #define dmac_clean_range __glue(_CACHE,_dma_clean_range) | 246 | #define dmac_clean_range __glue(_CACHE,_dma_clean_range) |
247 | #define dmac_flush_range __glue(_CACHE,_dma_flush_range) | 247 | #define dmac_flush_range __glue(_CACHE,_dma_flush_range) |
248 | 248 | ||
249 | extern void dmac_inv_range(unsigned long, unsigned long); | 249 | extern void dmac_inv_range(const void *, const void *); |
250 | extern void dmac_clean_range(unsigned long, unsigned long); | 250 | extern void dmac_clean_range(const void *, const void *); |
251 | extern void dmac_flush_range(unsigned long, unsigned long); | 251 | extern void dmac_flush_range(const void *, const void *); |
252 | 252 | ||
253 | #endif | 253 | #endif |
254 | 254 | ||
diff --git a/include/asm-arm/dma-mapping.h b/include/asm-arm/dma-mapping.h index 9bc46b486afb..a1d574cdcc14 100644 --- a/include/asm-arm/dma-mapping.h +++ b/include/asm-arm/dma-mapping.h | |||
@@ -17,7 +17,7 @@ | |||
17 | * platforms with CONFIG_DMABOUNCE. | 17 | * platforms with CONFIG_DMABOUNCE. |
18 | * Use the driver DMA support - see dma-mapping.h (dma_sync_*) | 18 | * Use the driver DMA support - see dma-mapping.h (dma_sync_*) |
19 | */ | 19 | */ |
20 | extern void consistent_sync(void *kaddr, size_t size, int rw); | 20 | extern void consistent_sync(const void *kaddr, size_t size, int rw); |
21 | 21 | ||
22 | /* | 22 | /* |
23 | * Return whether the given device DMA address mask can be supported | 23 | * Return whether the given device DMA address mask can be supported |