Pass struct dev pointer to dma_cache_sync()
Subsystems (8)
PATCH 1/1 Pass struct dev pointer to dma_cache_sync()
So following the previous patch to pass a struct dev pointer to dma_is_consistent() there is still dma_cache_sync left which does not receive a dev pointer.
Ralf
---------
Pass struct dev pointer to dma_cache_sync()
dma_cache_sync() 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_cache_sync to take a struct device pointer as first argument and fix all its callers to pass it.
Signed-off-by Ralf Baechle <[email protected]>
--- Documentation/DMA-API.txt | 2 - arch/avr32/mm/dma-coherent.c | 2 - arch/mips/mm/dma-coherent.c | 2 - arch/mips/mm/dma-ip27.c | 2 - arch/mips/mm/dma-ip32.c | 3 + arch/mips/mm/dma-noncoherent.c | 3 + drivers/net/lasi_82596.c | 94 +++++++++++++++++++------------------ drivers/scsi/53c700.c | 80 +++++++++++++++++-------------- drivers/scsi/53c700.h | 16 +++--- drivers/serial/mpsc.c | 22 ++++----- include/asm-alpha/dma-mapping.h | 2 - include/asm-avr32/dma-mapping.h | 3 + include/asm-cris/dma-mapping.h | 2 - include/asm-frv/dma-mapping.h | 2 - include/asm-generic/dma-mapping.h | 2 - include/asm-i386/dma-mapping.h | 2 - include/asm-ia64/dma-mapping.h | 3 + include/asm-m68k/dma-mapping.h | 2 - include/asm-mips/dma-mapping.h | 2 - include/asm-parisc/dma-mapping.h | 2 - include/asm-powerpc/dma-mapping.h | 2 - include/asm-sh/dma-mapping.h | 2 - include/asm-sh64/dma-mapping.h | 2 - include/asm-sparc64/dma-mapping.h | 2 - include/asm-um/dma-mapping.h | 2 - include/asm-x86_64/dma-mapping.h | 3 + include/asm-xtensa/dma-mapping.h | 2 - 27 files changed, 137 insertions(+), 126 deletions(-)
Documentation/DMA-API.txt +1 -1
@@ -459,7 +459,7 @@ anything like this. You must also be ex memory you intend to sync partially. void -dma_cache_sync(void *vaddr, size_t size, +dma_cache_sync(struct device *dev, void *vaddr, size_t size, enum dma_data_direction direction) Do a partial sync of memory that was allocated by
arch/avr32/mm/dma-coherent.c +1 -1
@@ -11,7 +11,7 @@ #include <linux/dma-mapping.h>#include <asm/addrspace.h> #include <asm/cacheflush.h> -void dma_cache_sync (void *vaddr,size_t size,int direction) +void dma_cache_sync (struct device *dev,void *vaddr,size_t size,int direction) {/* * No need to sync an uncached area
arch/mips/mm/dma-coherent.c +1 -1
@@ -197,7 +197,7 @@ int dma_is_consistent(struct device *devEXPORT_SYMBOL (dma_is_consistent); -void dma_cache_sync (void *vaddr,size_t size, +void dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction direction) {BUG_ON (direction ==DMA_NONE );
arch/mips/mm/dma-ip27.c +1 -1
@@ -204,7 +204,7 @@ int dma_is_consistent(struct device *devEXPORT_SYMBOL (dma_is_consistent); -void dma_cache_sync (void *vaddr,size_t size, +void dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction direction) {BUG_ON (direction ==DMA_NONE );
arch/mips/mm/dma-ip32.c +2 -1
@@ -370,7 +370,8 @@ int dma_is_consistent(struct device *devEXPORT_SYMBOL (dma_is_consistent); -void dma_cache_sync (void *vaddr,size_t size,enum dma_data_direction direction) +void dma_cache_sync (struct device *dev,void *vaddr,size_t size, +enum dma_data_direction direction) {if (direction ==DMA_NONE )return ;
arch/mips/mm/dma-noncoherent.c +2 -1
@@ -306,7 +306,8 @@ int dma_is_consistent(struct device *devEXPORT_SYMBOL (dma_is_consistent); -void dma_cache_sync (void *vaddr,size_t size,enum dma_data_direction direction) +void dma_cache_sync (struct device *dev,void *vaddr,size_t size, +enum dma_data_direction direction) {if (direction ==DMA_NONE )return ;
drivers/net/lasi_82596.c +47 -47
307 lines not on this page · raw message
drivers/scsi/53c700.c +43 -37
185 lines not on this page · raw message
drivers/scsi/53c700.h +8 -8
@@ -415,31 +415,31 @@ #define NCR_700_MIN_XFERP 1#define NCR_710_MIN_XFERP 0#define NCR_700_MIN_PERIOD 25/* for SDTR message, 100ns */ -#define script_patch_32 (script, symbol, value) \ +#define script_patch_32 (dev, script, symbol, value) \ { \ int i; \ for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \ __u32 val = bS_to_cpu((script)[A_##symbol##_used[i]]) + value; \ (script)[A_##symbol##_used[i]] = bS_to_host(val); \ - dma_cache_sync(&(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ + dma_cache_sync((dev), &(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ DEBUG((" script, patching %s at %d to 0x%lx\n", \ #symbol, A_##symbol##_used[i], (value))); \ } \ } -#define script_patch_32_abs (script, symbol, value) \ +#define script_patch_32_abs (dev, script, symbol, value) \ { \ int i; \ for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \ (script)[A_##symbol##_used[i]] = bS_to_host(value); \ - dma_cache_sync(&(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ + dma_cache_sync((dev), &(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ DEBUG((" script, patching %s at %d to 0x%lx\n", \ #symbol, A_##symbol##_used[i], (value))); \ } \ }/* Used for patching the SCSI ID in the SELECT instruction */ -#define script_patch_ID (script, symbol, value) \ +#define script_patch_ID (dev, script, symbol, value) \ { \ int i; \ for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \
@@ -447,13 +447,13 @@ #define script_patch_ID(script, symbol, val &=0xff00ffff ; \ val |= ((value) &0xff ) <<16 ; \ (script)[A_##symbol##_used[i]] = bS_to_host(val); \ - dma_cache_sync(&(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ + dma_cache_sync((dev), &(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ DEBUG((" script, patching ID field %s at %d to 0x%x\n", \ #symbol, A_##symbol##_used[i], val)); \ } \ } -#define script_patch_16 (script, symbol, value) \ +#define script_patch_16 (dev, script, symbol, value) \ { \ int i; \ for(i=0; i< (sizeof(A_##symbol##_used) / sizeof(__u32)); i++) { \
@@ -461,7 +461,7 @@ #define script_patch_16(script, symbol, val &=0xffff0000 ; \ val |= ((value) &0xffff ); \ (script)[A_##symbol##_used[i]] = bS_to_host(val); \ - dma_cache_sync(&(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ + dma_cache_sync((dev), &(script)[A_##symbol##_used[i]], 4, DMA_TO_DEVICE); \ DEBUG((" script, patching short field %s at %d to 0x%x\n", \ #symbol, A_##symbol##_used[i], val)); \ } \
drivers/serial/mpsc.c +11 -11
@@ -555,7 +555,7 @@ mpsc_sdma_start_tx(struct mpsc_port_infoif (!mpsc_sdma_tx_active (pi)) { txre = (struct mpsc_tx_desc *)(pi->txr + (pi->txr_tail *MPSC_TXRE_SIZE )); -dma_cache_sync ((void *) txre,MPSC_TXRE_SIZE ,DMA_FROM_DEVICE ); +dma_cache_sync (pi->port.dev, (void *) txre,MPSC_TXRE_SIZE ,DMA_FROM_DEVICE );#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE )if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */ invalidate_dcache_range((ulong)txre,
@@ -931,7 +931,7 @@ mpsc_init_rings(struct mpsc_port_info *p } txre->link =cpu_to_be32 (pi->txr_p);/* Wrap last back to first */ -dma_cache_sync ((void *) pi->dma_region,MPSC_DMA_ALLOC_SIZE , +dma_cache_sync (pi->port.dev, (void *) pi->dma_region,MPSC_DMA_ALLOC_SIZE ,DMA_BIDIRECTIONAL );#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE )if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */
@@ -1005,7 +1005,7 @@ mpsc_rx_intr(struct mpsc_port_info *pi) rxre = (struct mpsc_rx_desc *)(pi->rxr + (pi->rxr_posn*MPSC_RXRE_SIZE )); -dma_cache_sync ((void *)rxre,MPSC_RXRE_SIZE ,DMA_FROM_DEVICE ); +dma_cache_sync (pi->port.dev, (void *)rxre,MPSC_RXRE_SIZE ,DMA_FROM_DEVICE );#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE )if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */ invalidate_dcache_range((ulong)rxre,
@@ -1029,7 +1029,7 @@ #endif } bp = pi->rxb + (pi->rxr_posn *MPSC_RXBE_SIZE ); -dma_cache_sync ((void *) bp,MPSC_RXBE_SIZE ,DMA_FROM_DEVICE ); +dma_cache_sync (pi->port.dev, (void *) bp,MPSC_RXBE_SIZE ,DMA_FROM_DEVICE );#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE )if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */ invalidate_dcache_range((ulong)bp,
@@ -1098,7 +1098,7 @@ next_frame:SDMA_DESC_CMDSTAT_F | SDMA_DESC_CMDSTAT_L);wmb (); -dma_cache_sync ((void *)rxre,MPSC_RXRE_SIZE ,DMA_BIDIRECTIONAL ); +dma_cache_sync (pi->port.dev, (void *)rxre,MPSC_RXRE_SIZE ,DMA_BIDIRECTIONAL );#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE )if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */ flush_dcache_range((ulong)rxre,
@@ -1109,7 +1109,7 @@ #endif pi->rxr_posn = (pi->rxr_posn +1 ) & (MPSC_RXR_ENTRIES -1 ); rxre = (struct mpsc_rx_desc *)(pi->rxr + (pi->rxr_posn *MPSC_RXRE_SIZE )); -dma_cache_sync ((void *)rxre,MPSC_RXRE_SIZE ,DMA_FROM_DEVICE ); +dma_cache_sync (pi->port.dev, (void *)rxre,MPSC_RXRE_SIZE ,DMA_FROM_DEVICE );#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE )if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */ invalidate_dcache_range((ulong)rxre,
@@ -1143,7 +1143,7 @@ mpsc_setup_tx_desc(struct mpsc_port_info SDMA_DESC_CMDSTAT_EI : 0));wmb (); -dma_cache_sync ((void *) txre,MPSC_TXRE_SIZE ,DMA_BIDIRECTIONAL ); +dma_cache_sync (pi->port.dev, (void *) txre,MPSC_TXRE_SIZE ,DMA_BIDIRECTIONAL );#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE )if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */ flush_dcache_range((ulong)txre,
@@ -1192,7 +1192,7 @@ mpsc_copy_tx_data(struct mpsc_port_infoelse /* All tx data copied into ring bufs */ return ; -dma_cache_sync ((void *) bp,MPSC_TXBE_SIZE ,DMA_BIDIRECTIONAL ); +dma_cache_sync (pi->port.dev, (void *) bp,MPSC_TXBE_SIZE ,DMA_BIDIRECTIONAL );#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE )if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */ flush_dcache_range((ulong)bp,
@@ -1217,7 +1217,7 @@ mpsc_tx_intr(struct mpsc_port_info *pi) txre = (struct mpsc_tx_desc *)(pi->txr + (pi->txr_tail *MPSC_TXRE_SIZE )); -dma_cache_sync ((void *) txre,MPSC_TXRE_SIZE ,DMA_FROM_DEVICE ); +dma_cache_sync (pi->port.dev, (void *) txre,MPSC_TXRE_SIZE ,DMA_FROM_DEVICE );#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE )if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */ invalidate_dcache_range((ulong)txre,
@@ -1235,7 +1235,7 @@ #endif txre = (struct mpsc_tx_desc *)(pi->txr + (pi->txr_tail *MPSC_TXRE_SIZE )); -dma_cache_sync ((void *) txre,MPSC_TXRE_SIZE , +dma_cache_sync (pi->port.dev, (void *) txre,MPSC_TXRE_SIZE ,DMA_FROM_DEVICE );#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE )if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */
@@ -1652,7 +1652,7 @@ mpsc_console_write(struct console *co, c count--; } -dma_cache_sync ((void *) bp,MPSC_TXBE_SIZE ,DMA_BIDIRECTIONAL ); +dma_cache_sync (pi->port.dev, (void *) bp,MPSC_TXBE_SIZE ,DMA_BIDIRECTIONAL );#if defined(CONFIG_PPC32 ) && !defined(CONFIG_NOT_COHERENT_CACHE )if (pi->cache_mgmt)/* GT642[46]0 Res #COMM-2 */ flush_dcache_range((ulong)bp,
include/asm-alpha/dma-mapping.h +1 -1
@@ -60,7 +60,7 @@ #define dma_sync_single_for_device(dev,#define dma_sync_single_range (dev, addr, off, size, dir) do { } while (0)#define dma_sync_sg_for_cpu (dev, sg, nents, dir) do { } while (0)#define dma_sync_sg_for_device (dev, sg, nents, dir) do { } while (0) -#define dma_cache_sync (va, size, dir) do { } while (0) +#define dma_cache_sync (dev, va, size, dir) do { } while (0)#define dma_get_cache_alignment () L1_CACHE_BYTES
include/asm-avr32/dma-mapping.h +2 -1
@@ -8,7 +8,8 @@ #include <asm/processor.h>#include <asm/cacheflush.h> #include <asm/io.h> -extern void dma_cache_sync (void *vaddr,size_t size,int direction); +extern void dma_cache_sync (struct device *dev,void *vaddr,size_t size, +int direction);/* * Return whether the given device DMA address mask can be supported
include/asm-cris/dma-mapping.h +1 -1
@@ -159,7 +159,7 @@ dma_get_cache_alignment(void)#define dma_is_consistent (d, h) (1)static inline void -dma_cache_sync (void *vaddr,size_t size, +dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction direction) { }
include/asm-frv/dma-mapping.h +1 -1
@@ -175,7 +175,7 @@ int dma_get_cache_alignment(void)#define dma_is_consistent (d, h) (1)static inline -void dma_cache_sync (void *vaddr,size_t size, +void dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction direction) {flush_write_buffers ();
include/asm-generic/dma-mapping.h +1 -1
@@ -295,7 +295,7 @@ dma_sync_single_range_for_device(struct }static inline void -dma_cache_sync (void *vaddr,size_t size, +dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction direction) {/* could define this in terms of the dma_cache ... operations,
include/asm-i386/dma-mapping.h +1 -1
@@ -159,7 +159,7 @@ dma_get_cache_alignment(void)#define dma_is_consistent (d, h) (1)static inline void -dma_cache_sync (void *vaddr,size_t size, +dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction direction) {flush_write_buffers ();
include/asm-ia64/dma-mapping.h +2 -1
@@ -50,7 +50,8 @@ dma_set_mask (struct device *dev, u64 maextern int dma_get_cache_alignment (void );static inline void -dma_cache_sync (void *vaddr,size_t size,enum dma_data_direction dir) +dma_cache_sync (struct device *dev,void *vaddr,size_t size, +enum dma_data_direction dir) {/* * IA-64 is cache-coherent, so this is mostly a no-op. However, we do need to
include/asm-m68k/dma-mapping.h +1 -1
@@ -41,7 +41,7 @@ static inline void dma_free_noncoherent( {dma_free_coherent (dev, size, addr, handle); } -static inline void dma_cache_sync (void *vaddr,size_t size, +static inline void dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction dir) {/* we use coherent allocation, so not much to do here. */
include/asm-mips/dma-mapping.h +1 -1
@@ -65,7 +65,7 @@ dma_get_cache_alignment(void)extern int dma_is_consistent (struct device *dev,dma_addr_t dma_addr); -extern void dma_cache_sync (void *vaddr,size_t size, +extern void dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction direction);#define ARCH_HAS_DMA_DECLARE_COHERENT_MEMORY
include/asm-parisc/dma-mapping.h +1 -1
@@ -197,7 +197,7 @@ dma_is_consistent(struct device *dev, dm }static inline void -dma_cache_sync (void *vaddr,size_t size, +dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction direction) {if (hppa_dma_ops->dma_sync_single_for_cpu)
include/asm-powerpc/dma-mapping.h +1 -1
@@ -254,7 +254,7 @@ static inline void dma_sync_single_rangedma_sync_single_for_device (dev, dma_handle, offset + size, direction); } -static inline void dma_cache_sync (void *vaddr,size_t size, +static inline void dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction direction) {BUG_ON (direction ==DMA_NONE );
include/asm-sh/dma-mapping.h +1 -1
@@ -53,7 +53,7 @@ static inline void dma_free_coherent(strconsistent_free (vaddr, size); } -static inline void dma_cache_sync (void *vaddr,size_t size, +static inline void dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction dir) {consistent_sync (vaddr, size, (int )dir);
include/asm-sh64/dma-mapping.h +1 -1
@@ -35,7 +35,7 @@ static inline void dma_free_coherent(strconsistent_free (NULL , size, vaddr, dma_handle); } -static inline void dma_cache_sync (void *vaddr,size_t size, +static inline void dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction dir) {dma_cache_wback_inv ((unsigned long )vaddr, size);
include/asm-sparc64/dma-mapping.h +1 -1
@@ -210,7 +210,7 @@ dma_sync_single_range_for_device(struct }static inline void -dma_cache_sync (void *vaddr,size_t size, +dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction direction) {/* could define this in terms of the dma_cache ... operations,
include/asm-um/dma-mapping.h +1 -1
@@ -112,7 +112,7 @@ dma_sync_single_range(struct device *dev }static inline void -dma_cache_sync (void *vaddr,size_t size, +dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction direction) {BUG ();
include/asm-x86_64/dma-mapping.h +2 -1
@@ -185,7 +185,8 @@ #define dma_is_consistent(d, h) 1extern int dma_set_mask (struct device *dev,u64 mask);static inline void -dma_cache_sync (void *vaddr,size_t size,enum dma_data_direction dir) +dma_cache_sync (struct device *dev,void *vaddr,size_t size, +enum dma_data_direction dir) {flush_write_buffers (); }
include/asm-xtensa/dma-mapping.h +1 -1
@@ -173,7 +173,7 @@ dma_get_cache_alignment(void)#define dma_is_consistent (d, h) (1)static inline void -dma_cache_sync (void *vaddr,size_t size, +dma_cache_sync (struct device *dev,void *vaddr,size_t size,enum dma_data_direction direction) {consistent_sync (vaddr, size, direction);