]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
[PATCH] Add struct dev pointer to dma_is_consistent()
authorRalf Baechle <ralf@linux-mips.org>
Thu, 7 Dec 2006 04:38:54 +0000 (20:38 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Thu, 7 Dec 2006 16:39:41 +0000 (08:39 -0800)
dma_is_consistent() is ill-designed in that it does not have a struct
device pointer argument which makes proper support for systems that consist
of a mix of coherent and non-coherent DMA devices hard.  Change
dma_is_consistent to take a struct device pointer as first argument and fix
the sole caller to pass it.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
22 files changed:
Documentation/DMA-API.txt
arch/mips/mm/dma-coherent.c
arch/mips/mm/dma-ip27.c
arch/mips/mm/dma-ip32.c
arch/mips/mm/dma-noncoherent.c
drivers/scsi/53c700.c
include/asm-alpha/dma-mapping.h
include/asm-arm/dma-mapping.h
include/asm-avr32/dma-mapping.h
include/asm-cris/dma-mapping.h
include/asm-frv/dma-mapping.h
include/asm-generic/dma-mapping.h
include/asm-i386/dma-mapping.h
include/asm-ia64/dma-mapping.h
include/asm-m68k/dma-mapping.h
include/asm-mips/dma-mapping.h
include/asm-parisc/dma-mapping.h
include/asm-powerpc/dma-mapping.h
include/asm-sparc64/dma-mapping.h
include/asm-um/dma-mapping.h
include/asm-x86_64/dma-mapping.h
include/asm-xtensa/dma-mapping.h

index 8621a064f7e135d0f6c26b5897de5c4efb1c0924..3dc1f9125caffa0ece682384b289d2d03fd7bcab 100644 (file)
@@ -431,10 +431,10 @@ be identical to those passed in (and returned by
 dma_alloc_noncoherent()).
 
 int
-dma_is_consistent(dma_addr_t dma_handle)
+dma_is_consistent(struct device *dev, dma_addr_t dma_handle)
 
-returns true if the memory pointed to by the dma_handle is actually
-consistent.
+returns true if the device dev is performing consistent DMA on the memory
+area pointed to by the dma_handle.
 
 int
 dma_get_cache_alignment(void)
index 7fa5fd16e46bfe846b5c47063d7d85e5dab54f57..18bc83e577c196888556c26edcc2ef246603efc4 100644 (file)
@@ -190,7 +190,7 @@ int dma_supported(struct device *dev, u64 mask)
 
 EXPORT_SYMBOL(dma_supported);
 
-int dma_is_consistent(dma_addr_t dma_addr)
+int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
 {
        return 1;
 }
index 8da19fd22ac6f0bbbf5b64d3408e611b5f215f99..8e9a5a8f5d65d68088354bed6fbd24e81195ff22 100644 (file)
@@ -197,7 +197,7 @@ int dma_supported(struct device *dev, u64 mask)
 
 EXPORT_SYMBOL(dma_supported);
 
-int dma_is_consistent(dma_addr_t dma_addr)
+int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
 {
        return 1;
 }
index ec54ed0d26ff23fbf257e6e6193cf9a8eeb06815..08720a42100f717a09b7c36a4e978efd8baa19c7 100644 (file)
@@ -363,7 +363,7 @@ int dma_supported(struct device *dev, u64 mask)
 
 EXPORT_SYMBOL(dma_supported);
 
-int dma_is_consistent(dma_addr_t dma_addr)
+int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
 {
        return 1;
 }
index 2eeffe5c2a3a40315c69cd0a6defc907cb4eb292..4a3efc6333739738946ac3a3b32f94f805a033bd 100644 (file)
@@ -299,7 +299,7 @@ int dma_supported(struct device *dev, u64 mask)
 
 EXPORT_SYMBOL(dma_supported);
 
-int dma_is_consistent(dma_addr_t dma_addr)
+int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
 {
        return 1;
 }
index 335a25540c08687b5c171aa74ec7124c7465cace..acee062cd6f66ccdf984c2623fc40dbc29281174 100644 (file)
@@ -313,7 +313,7 @@ NCR_700_detect(struct scsi_host_template *tpnt,
        hostdata->status = memory + STATUS_OFFSET;
        /* all of these offsets are L1_CACHE_BYTES separated.  It is fatal
         * if this isn't sufficient separation to avoid dma flushing issues */
-       BUG_ON(!dma_is_consistent(pScript) && L1_CACHE_BYTES < dma_get_cache_alignment());
+       BUG_ON(!dma_is_consistent(hostdata->dev, pScript) && L1_CACHE_BYTES < dma_get_cache_alignment());
        hostdata->slots = (struct NCR_700_command_slot *)(memory + SLOTS_OFFSET);
        hostdata->dev = dev;
 
index b9ff4d8cb33a95dd5c50db2d77c88a110c415d70..b274bf6317c7aace5625af2bb704a69cab4e163a 100644 (file)
@@ -51,7 +51,7 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
 
 #define dma_alloc_noncoherent(d, s, h, f)      dma_alloc_coherent(d, s, h, f)
 #define dma_free_noncoherent(d, s, v, h)       dma_free_coherent(d, s, v, h)
-#define dma_is_consistent(dev)                 (1)
+#define dma_is_consistent(d, h)                        (1)
 
 int dma_set_mask(struct device *dev, u64 mask);
 
index 666617711c81d259745ba2b0dc12d935c4d4fb0a..9bc46b486afba7a5970e93b5c938a3be33c4684e 100644 (file)
@@ -48,7 +48,7 @@ static inline int dma_get_cache_alignment(void)
        return 32;
 }
 
-static inline int dma_is_consistent(dma_addr_t handle)
+static inline int dma_is_consistent(struct device *dev, dma_addr_t handle)
 {
        return !!arch_is_coherent();
 }
index 4c40cb41cdf8399a188e2da74bb379f25f113dbd..44630be2ee22faa5269da6feb8c4ded2b960a78f 100644 (file)
@@ -307,7 +307,7 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
 
-static inline int dma_is_consistent(dma_addr_t dma_addr)
+static inline int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
 {
        return 1;
 }
index cbf1a98f012975d67ca8b3b5efd04b896ccc38b8..af704fdd3d0d3b9314264a4366bf418b567d431a 100644 (file)
@@ -156,7 +156,7 @@ dma_get_cache_alignment(void)
        return (1 << INTERNODE_CACHE_SHIFT);
 }
 
-#define dma_is_consistent(d)   (1)
+#define dma_is_consistent(d, h)        (1)
 
 static inline void
 dma_cache_sync(void *vaddr, size_t size,
index e9fc1d47797e295664a0fa5f025b80bdce7fb50b..7b97fc785f72d21ed99e88f5cd961afe3c16b3e6 100644 (file)
@@ -172,7 +172,7 @@ int dma_get_cache_alignment(void)
        return 1 << L1_CACHE_SHIFT;
 }
 
-#define dma_is_consistent(d)   (1)
+#define dma_is_consistent(d, h)        (1)
 
 static inline
 void dma_cache_sync(void *vaddr, size_t size,
index b541e48cc545f6c467bc5ca691731a8535df98bd..b9be3fc344c7830956a194445c15619bb822c3bd 100644 (file)
@@ -266,7 +266,7 @@ dma_error(dma_addr_t dma_addr)
 
 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
-#define dma_is_consistent(d)   (1)
+#define dma_is_consistent(d, h)        (1)
 
 static inline int
 dma_get_cache_alignment(void)
index 81999a3ebe7c4c712ac91da21fc963e24c638270..7da64c9f1738aff7719a8b249a60413c238d6108 100644 (file)
@@ -156,7 +156,7 @@ dma_get_cache_alignment(void)
        return (1 << INTERNODE_CACHE_SHIFT);
 }
 
-#define dma_is_consistent(d)   (1)
+#define dma_is_consistent(d, h)        (1)
 
 static inline void
 dma_cache_sync(void *vaddr, size_t size,
index 99a8f8e1218c18283fbfe96baf1547d5e3b500d9..4b075bc032ec992fca118f92ad1eeb47669fdfd2 100644 (file)
@@ -59,6 +59,6 @@ dma_cache_sync (void *vaddr, size_t size, enum dma_data_direction dir)
        mb();
 }
 
-#define dma_is_consistent(dma_handle)  (1)     /* all we do is coherent memory... */
+#define dma_is_consistent(d, h)        (1)     /* all we do is coherent memory... */
 
 #endif /* _ASM_IA64_DMA_MAPPING_H */
index d90d841d3dfde278269de086af882d87346a9892..efc89c12f83725f4325ea5a704e8cd48640ff19e 100644 (file)
@@ -21,7 +21,7 @@ static inline int dma_get_cache_alignment(void)
        return 1 << L1_CACHE_SHIFT;
 }
 
-static inline int dma_is_consistent(dma_addr_t dma_addr)
+static inline int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
 {
        return 0;
 }
index 43288634c38a7bbca2793d295f801de22ffaf2ea..e17f70d7b702a8f5302b9cd91db5edf5af0a74f3 100644 (file)
@@ -63,7 +63,7 @@ dma_get_cache_alignment(void)
        return 128;
 }
 
-extern int dma_is_consistent(dma_addr_t dma_addr);
+extern int dma_is_consistent(struct device *dev, dma_addr_t dma_addr);
 
 extern void dma_cache_sync(void *vaddr, size_t size,
               enum dma_data_direction direction);
index 1e387e1dad3044a99a718c7ca5b86142b4a0b844..c40d48afdc5238dc2af74f4ac3848c5e22c55c88 100644 (file)
@@ -191,7 +191,7 @@ dma_get_cache_alignment(void)
 }
 
 static inline int
-dma_is_consistent(dma_addr_t dma_addr)
+dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
 {
        return (hppa_dma_ops->dma_sync_single_for_cpu == NULL);
 }
index 7e38b5fddada918a8b7decdafa9c87139e5d4aff..3cf635b53b881308948cae8e9d94683a3a82b738 100644 (file)
@@ -342,9 +342,9 @@ static inline int dma_mapping_error(dma_addr_t dma_addr)
 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
 #ifdef CONFIG_NOT_COHERENT_CACHE
-#define dma_is_consistent(d)   (0)
+#define dma_is_consistent(d, h)        (0)
 #else
-#define dma_is_consistent(d)   (1)
+#define dma_is_consistent(d, h)        (1)
 #endif
 
 static inline int dma_get_cache_alignment(void)
index 27c46fbeebd6cd5c8ec59491d14114ac686a23b3..5fe0072f3f8296ed5832c402b1c6dfac22f42e6b 100644 (file)
@@ -181,7 +181,7 @@ dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t siz
 
 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
-#define dma_is_consistent(d)   (1)
+#define dma_is_consistent(d, h)        (1)
 
 static inline int
 dma_get_cache_alignment(void)
index babd2989511465887973098e1619e6d20a067669..defb5b8307de9728c770f6807acd2e7cb22e1522 100644 (file)
@@ -94,7 +94,7 @@ dma_sync_sg(struct device *dev, struct scatterlist *sg, int nelems,
 
 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
-#define dma_is_consistent(d) (1)
+#define dma_is_consistent(d, h) (1)
 
 static inline int
 dma_get_cache_alignment(void)
index 10174b110a5cf9bb332b531c24f2cedef3b35c0a..c8cc4887fba6a771a3252799baa9028b820419cd 100644 (file)
@@ -180,7 +180,7 @@ static inline int dma_get_cache_alignment(void)
        return boot_cpu_data.x86_clflush_size;
 }
 
-#define dma_is_consistent(h) 1
+#define dma_is_consistent(d, h) 1
 
 extern int dma_set_mask(struct device *dev, u64 mask);
 
index c39c91dfcc695a55e16933d60974310460987151..827d1dfd9e1d3d36256c300cd28edfe6566f40da 100644 (file)
@@ -170,7 +170,7 @@ dma_get_cache_alignment(void)
        return L1_CACHE_BYTES;
 }
 
-#define dma_is_consistent(d)   (1)
+#define dma_is_consistent(d, h)        (1)
 
 static inline void
 dma_cache_sync(void *vaddr, size_t size,