]> Pileus Git - ~andy/linux/commitdiff
[ARM] Convert DMA cache handling to take const void * args
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Tue, 6 Feb 2007 17:39:31 +0000 (17:39 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 8 Feb 2007 14:49:44 +0000 (14:49 +0000)
The DMA cache handling functions take virtual addresses, but in the
form of unsigned long arguments.  This leads to a little confusion
about what exactly they take.  So, convert them to take const void *
instead.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/common/dmabounce.c
arch/arm/mm/consistent.c
include/asm-arm/cacheflush.h
include/asm-arm/dma-mapping.h

index b4748e3171c6890b39e97aa239ac4dc3459148e7..2362c498f52ebef5702654da992b70f82bddbbef 100644 (file)
@@ -321,12 +321,12 @@ unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
                DO_STATS ( device_info->bounce_count++ );
 
                if (dir == DMA_FROM_DEVICE || dir == DMA_BIDIRECTIONAL) {
-                       unsigned long ptr;
+                       void *ptr = buf->ptr;
 
                        dev_dbg(dev,
                                "%s: copy back safe %p to unsafe %p size %d\n",
-                               __func__, buf->safe, buf->ptr, size);
-                       memcpy(buf->ptr, buf->safe, size);
+                               __func__, buf->safe, ptr, size);
+                       memcpy(ptr, buf->safe, size);
 
                        /*
                         * 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,
                         * bidirectional case because we know the cache
                         * lines will be coherent with the data written.
                         */
-                       ptr = (unsigned long)buf->ptr;
                        dmac_clean_range(ptr, ptr + size);
                        outer_clean_range(__pa(ptr), __pa(ptr) + size);
                }
index 83bd035c7d5e8d4f359af40f79a33df95abf9b61..166aee13c4b1bd40e963e6b14132796d04aec757 100644 (file)
@@ -205,10 +205,10 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
         * kernel direct-mapped region for device DMA.
         */
        {
-               unsigned long kaddr = (unsigned long)page_address(page);
-               memset(page_address(page), 0, size);
-               dmac_flush_range(kaddr, kaddr + size);
-               outer_flush_range(__pa(kaddr), __pa(kaddr) + size);
+               void *ptr = page_address(page);
+               memset(ptr, 0, size);
+               dmac_flush_range(ptr, ptr + size);
+               outer_flush_range(__pa(ptr), __pa(ptr) + size);
        }
 
        /*
@@ -481,10 +481,9 @@ core_initcall(consistent_init);
  * platforms with CONFIG_DMABOUNCE.
  * Use the driver DMA support - see dma-mapping.h (dma_sync_*)
  */
-void consistent_sync(void *vaddr, size_t size, int direction)
+void consistent_sync(const void *start, size_t size, int direction)
 {
-       unsigned long start = (unsigned long)vaddr;
-       unsigned long end   = start + size;
+       const void *end = start + size;
 
        BUG_ON(!virt_addr_valid(start) || !virt_addr_valid(end));
 
index ce60b3702ba5588e742697610d1dd6d4885f96c6..afad32c76e6c964df908c6493441139ccb328977 100644 (file)
@@ -185,9 +185,9 @@ struct cpu_cache_fns {
        void (*coherent_user_range)(unsigned long, unsigned long);
        void (*flush_kern_dcache_page)(void *);
 
-       void (*dma_inv_range)(unsigned long, unsigned long);
-       void (*dma_clean_range)(unsigned long, unsigned long);
-       void (*dma_flush_range)(unsigned long, unsigned long);
+       void (*dma_inv_range)(const void *, const void *);
+       void (*dma_clean_range)(const void *, const void *);
+       void (*dma_flush_range)(const void *, const void *);
 };
 
 struct outer_cache_fns {
@@ -246,9 +246,9 @@ extern void __cpuc_flush_dcache_page(void *);
 #define dmac_clean_range               __glue(_CACHE,_dma_clean_range)
 #define dmac_flush_range               __glue(_CACHE,_dma_flush_range)
 
-extern void dmac_inv_range(unsigned long, unsigned long);
-extern void dmac_clean_range(unsigned long, unsigned long);
-extern void dmac_flush_range(unsigned long, unsigned long);
+extern void dmac_inv_range(const void *, const void *);
+extern void dmac_clean_range(const void *, const void *);
+extern void dmac_flush_range(const void *, const void *);
 
 #endif
 
index 9bc46b486afba7a5970e93b5c938a3be33c4684e..a1d574cdcc1428418802360ff645ad3ebe5fcd5c 100644 (file)
@@ -17,7 +17,7 @@
  * platforms with CONFIG_DMABOUNCE.
  * Use the driver DMA support - see dma-mapping.h (dma_sync_*)
  */
-extern void consistent_sync(void *kaddr, size_t size, int rw);
+extern void consistent_sync(const void *kaddr, size_t size, int rw);
 
 /*
  * Return whether the given device DMA address mask can be supported