m68k: use for_each_sg()
Subsystems (8)
PATCH v2 1/10 m68k: use for_each_sg()
This replaces the plain loop over the sglist array with for_each_sg() macro which consists of sg_next() function calls. Since m68k doesn't select ARCH_HAS_SG_CHAIN, it is not necessary to use for_each_sg() in order to loop over each sg element. But this can help find problems with drivers that do not properly initialize their sg tables when CONFIG_DEBUG_SG is enabled.
---
* Changes from v1
- Update commit log
arch/m68k/kernel/dma.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
arch/m68k/kernel/dma.c +12 -7
@@ -120,13 +120,16 @@ void dma_sync_single_for_device(struct device *dev, dma_addr_t handle, }EXPORT_SYMBOL (dma_sync_single_for_device); -void dma_sync_sg_for_device (struct device *dev,struct scatterlist *sg,int nents, -enum dma_data_direction dir) +void dma_sync_sg_for_device (struct device *dev,struct scatterlist *sglist, +int nents,enum dma_data_direction dir) {int i; +struct scatterlist *sg; -for (i =0 ; i < nents; sg++, i++) -dma_sync_single_for_device (dev, sg->dma_address, sg->length, dir); +for_each_sg (sglist, sg, nents, i) { +dma_sync_single_for_device (dev, sg->dma_address, sg->length, + dir); + } }EXPORT_SYMBOL (dma_sync_sg_for_device);
@@ -151,14 +154,16 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page, }EXPORT_SYMBOL (dma_map_page); -int dma_map_sg (struct device *dev,struct scatterlist *sg,int nents, +int dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction dir) {int i; +struct scatterlist *sg; -for (i =0 ; i < nents; sg++, i++) { +for_each_sg (sglist, sg, nents, i) { sg->dma_address =sg_phys (sg); -dma_sync_single_for_device (dev, sg->dma_address, sg->length, dir); +dma_sync_single_for_device (dev, sg->dma_address, sg->length, + dir); }return nents; }
Signature · 1 line
1.9.1
PATCH v2 2/10 arc: use for_each_sg()
This replaces the plain loop over the sglist array with for_each_sg() macro which consists of sg_next() function calls. Since arc doesn't select ARCH_HAS_SG_CHAIN, it is not necessary to use for_each_sg() in order to loop over each sg element. But this can help find problems with drivers that do not properly initialize their sg tables when CONFIG_DEBUG_SG is enabled.
---
* Changes from v1
- Update commit log
arch/arc/include/asm/dma-mapping.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
arch/arc/include/asm/dma-mapping.h +7 -5
@@ -178,22 +178,24 @@ dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle, }static inline void -dma_sync_sg_for_cpu (struct device *dev,struct scatterlist *sg,int nelems, +dma_sync_sg_for_cpu (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction dir) {int i; +struct scatterlist *sg; -for (i =0 ; i < nelems; i++, sg++) +for_each_sg (sglist, sg, nelems, i)_dma_cache_sync ((unsigned int )sg_virt (sg), sg->length, dir); }static inline void -dma_sync_sg_for_device (struct device *dev,struct scatterlist *sg,int nelems, -enum dma_data_direction dir) +dma_sync_sg_for_device (struct device *dev,struct scatterlist *sglist, +int nelems,enum dma_data_direction dir) {int i; +struct scatterlist *sg; -for (i =0 ; i < nelems; i++, sg++) +for_each_sg (sglist, sg, nelems, i)_dma_cache_sync ((unsigned int )sg_virt (sg), sg->length, dir); }
Signature · 1 line
1.9.1
PATCH v2 3/10 metag: use for_each_sg()
In reply to Akinobu MitaThis replaces the plain loop over the sglist array with for_each_sg() macro which consists of sg_next() function calls. Since metag doesn't select ARCH_HAS_SG_CHAIN, it is not necessary to use for_each_sg() in order to loop over each sg element. But this can help find problems with drivers that do not properly initialize their sg tables when CONFIG_DEBUG_SG is enabled.
---
* Changes from v1
- Update commit log
arch/metag/include/asm/dma-mapping.h | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
arch/metag/include/asm/dma-mapping.h +9 -5
@@ -134,20 +134,24 @@ dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle, }static inline void -dma_sync_sg_for_cpu (struct device *dev,struct scatterlist *sg,int nelems, +dma_sync_sg_for_cpu (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction direction) {int i; -for (i =0 ; i < nelems; i++, sg++) +struct scatterlist *sg; + +for_each_sg (sglist, sg, nelems, i)dma_sync_for_cpu (sg_virt (sg), sg->length, direction); }static inline void -dma_sync_sg_for_device (struct device *dev,struct scatterlist *sg,int nelems, -enum dma_data_direction direction) +dma_sync_sg_for_device (struct device *dev,struct scatterlist *sglist, +int nelems,enum dma_data_direction direction) {int i; -for (i =0 ; i < nelems; i++, sg++) +struct scatterlist *sg; + +for_each_sg (sglist, sg, nelems, i)dma_sync_for_device (sg_virt (sg), sg->length, direction); }
Signature · 1 line
1.9.1
PATCH v2 4/10 xtensa: use for_each_sg()
In reply to Akinobu MitaThis replaces the plain loop over the sglist array with for_each_sg() macro which consists of sg_next() function calls. Since xtensa doesn't select ARCH_HAS_SG_CHAIN, it is not necessary to use for_each_sg() in order to loop over each sg element. But this can help find problems with drivers that do not properly initialize their sg tables when CONFIG_DEBUG_SG is enabled.
---
* Changes from v1
- Update commit log
arch/xtensa/include/asm/dma-mapping.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
arch/xtensa/include/asm/dma-mapping.h +12 -7
@@ -52,14 +52,15 @@ dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, }static inline int -dma_map_sg (struct device *dev,struct scatterlist *sg,int nents, +dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction) {int i; +struct scatterlist *sg;BUG_ON (direction ==DMA_NONE ); -for (i =0 ; i < nents; i++, sg++ ) { +for_each_sg (sglist, sg, nents, i) {BUG_ON (!sg_page (sg)); sg->dma_address =sg_phys (sg);
@@ -124,20 +125,24 @@ dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,consistent_sync ((void *)bus_to_virt (dma_handle)+offset,size,direction); }static inline void -dma_sync_sg_for_cpu (struct device *dev,struct scatterlist *sg,int nelems, +dma_sync_sg_for_cpu (struct device *dev,struct scatterlist *sglist,int nelems,enum dma_data_direction dir) {int i; -for (i =0 ; i < nelems; i++, sg++) +struct scatterlist *sg; + +for_each_sg (sglist, sg, nelems, i)consistent_sync (sg_virt (sg), sg->length, dir); }static inline void -dma_sync_sg_for_device (struct device *dev,struct scatterlist *sg,int nelems, -enum dma_data_direction dir) +dma_sync_sg_for_device (struct device *dev,struct scatterlist *sglist, +int nelems,enum dma_data_direction dir) {int i; -for (i =0 ; i < nelems; i++, sg++) +struct scatterlist *sg; + +for_each_sg (sglist, sg, nelems, i)consistent_sync (sg_virt (sg), sg->length, dir); } static inline int
Signature · 1 line
1.9.1
PATCH v2 5/10 mips: use for_each_sg()
In reply to Akinobu MitaThis replaces the plain loop over the sglist array with for_each_sg() macro which consists of sg_next() function calls. Since mips doesn't select ARCH_HAS_SG_CHAIN, it is not necessary to use for_each_sg() in order to loop over each sg element. But this can help find problems with drivers that do not properly initialize their sg tables when CONFIG_DEBUG_SG is enabled.
---
* Changes from v1
- Update commit log
arch/mips/mm/dma-default.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-)
arch/mips/mm/dma-default.c +20 -10
@@ -262,12 +262,13 @@ static void mips_dma_unmap_page(struct device *dev, dma_addr_t dma_addr,plat_unmap_dma_mem (dev, dma_addr, size, direction); } -static int mips_dma_map_sg (struct device *dev,struct scatterlist *sg, +static int mips_dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction,struct dma_attrs *attrs) {int i; +struct scatterlist *sg; -for (i =0 ; i < nents; i++, sg++) { +for_each_sg (sglist, sg, nents, i) {if (!plat_device_is_coherent (dev))__dma_sync (sg_page (sg), sg->offset, sg->length, direction);
@@ -291,13 +292,14 @@ static dma_addr_t mips_dma_map_page(struct device *dev, struct page *page,return plat_map_dma_mem_page (dev, page) + offset; } -static void mips_dma_unmap_sg (struct device *dev,struct scatterlist *sg, +static void mips_dma_unmap_sg (struct device *dev,struct scatterlist *sglist,int nhwentries,enum dma_data_direction direction,struct dma_attrs *attrs) {int i; +struct scatterlist *sg; -for (i =0 ; i < nhwentries; i++, sg++) { +for_each_sg (sglist, sg, nhwentries, i) {if (!plat_device_is_coherent (dev) && direction !=DMA_TO_DEVICE ) __dma_sync(sg_page(sg), sg->offset, sg->length,
@@ -324,26 +326,34 @@ static void mips_dma_sync_single_for_device(struct device *dev, }static void mips_dma_sync_sg_for_cpu (struct device *dev, -struct scatterlist *sg,int nelems,enum dma_data_direction direction) +struct scatterlist *sglist,int nelems, +enum dma_data_direction direction) {int i; +struct scatterlist *sg; -if (cpu_needs_post_dma_flush (dev)) -for (i =0 ; i < nelems; i++, sg++) +if (cpu_needs_post_dma_flush (dev)) { +for_each_sg (sglist, sg, nelems, i) {__dma_sync (sg_page (sg), sg->offset, sg->length, direction); + } + }plat_post_dma_flush (dev); }static void mips_dma_sync_sg_for_device (struct device *dev, -struct scatterlist *sg,int nelems,enum dma_data_direction direction) +struct scatterlist *sglist,int nelems, +enum dma_data_direction direction) {int i; +struct scatterlist *sg; -if (!plat_device_is_coherent (dev)) -for (i =0 ; i < nelems; i++, sg++) +if (!plat_device_is_coherent (dev)) { +for_each_sg (sglist, sg, nelems, i) {__dma_sync (sg_page (sg), sg->offset, sg->length, direction); + } + } }int mips_dma_mapping_error (struct device *dev,dma_addr_t dma_addr)
Signature · 1 line
1.9.1
PATCH v2 6/10 frv: use for_each_sg()
In reply to Akinobu MitaThis replaces the plain loop over the sglist array with for_each_sg() macro which consists of sg_next() function calls. Since frv doesn't select ARCH_HAS_SG_CHAIN, it is not necessary to use for_each_sg() in order to loop over each sg element. But this can help find problems with drivers that do not properly initialize their sg tables when CONFIG_DEBUG_SG is enabled.
---
* New patch from v2
arch/frv/mb93090-mb00/pci-dma-nommu.c | 10 ++++++---- arch/frv/mb93090-mb00/pci-dma.c | 7 ++++--- 2 files changed, 10 insertions(+), 7 deletions(-)
arch/frv/mb93090-mb00/pci-dma-nommu.c +6 -4
@@ -119,14 +119,16 @@ dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,EXPORT_SYMBOL (dma_map_single); -int dma_map_sg (struct device *dev,struct scatterlist *sg,int nents, +int dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction) {int i; +struct scatterlist *sg; -for (i=0 ; i<nents; i++) -frv_cache_wback_inv (sg_dma_address (&sg[i]), -sg_dma_address (&sg[i]) +sg_dma_len (&sg[i])); +for_each_sg (sglist, sg, nents, i) { +frv_cache_wback_inv (sg_dma_address (sg), +sg_dma_address (sg) +sg_dma_len (sg)); + }BUG_ON (direction ==DMA_NONE );
arch/frv/mb93090-mb00/pci-dma.c +4 -3
@@ -50,19 +50,20 @@ dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,EXPORT_SYMBOL (dma_map_single); -int dma_map_sg (struct device *dev,struct scatterlist *sg,int nents, +int dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction) {unsigned long dampr2;void *vaddr;int i; +struct scatterlist *sg;BUG_ON (direction ==DMA_NONE ); dampr2 =__get_DAMPR (2 ); -for (i =0 ; i < nents; i++) { - vaddr =kmap_atomic_primary (sg_page (&sg[i])); +for_each_sg (sglist, sg, nents, i) { + vaddr =kmap_atomic_primary (sg_page (sg));frv_dcache_writeback ((unsigned long ) vaddr, (unsigned long ) vaddr +PAGE_SIZE );
Signature · 1 line
1.9.1
PATCH v2 7/10 avr32: use for_each_sg()
In reply to Akinobu MitaThis replaces the plain loop over the sglist array with for_each_sg() macro which consists of sg_next() function calls. Since avr32 doesn't select ARCH_HAS_SG_CHAIN, it is not necessary to use for_each_sg() in order to loop over each sg element. But this can help find problems with drivers that do not properly initialize their sg tables when CONFIG_DEBUG_SG is enabled.
---
* New patch from v2
arch/avr32/include/asm/dma-mapping.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
arch/avr32/include/asm/dma-mapping.h +10 -9
@@ -209,17 +209,18 @@ dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,* the same here. */ static inline int -dma_map_sg (struct device *dev,struct scatterlist *sg,int nents, +dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction) {int i; +struct scatterlist *sg; -for (i =0 ; i < nents; i++) { +for_each_sg (sglist, sg, nents, i) {char *virt; - sg[i].dma_address =page_to_bus (sg_page (&sg[i])) + sg[i].offset; - virt =sg_virt (&sg[i]); -dma_cache_sync (dev, virt, sg[i].length, direction); + sg->dma_address =page_to_bus (sg_page (sg)) + sg->offset; + virt =sg_virt (sg); +dma_cache_sync (dev, virt, sg->length, direction); }return nents;
@@ -321,14 +322,14 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, }static inline void -dma_sync_sg_for_device (struct device *dev,struct scatterlist *sg, +dma_sync_sg_for_device (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction) {int i; +struct scatterlist *sg; -for (i =0 ; i < nents; i++) { -dma_cache_sync (dev,sg_virt (&sg[i]), sg[i].length, direction); - } +for_each_sg (sglist, sg, nents, i) +dma_cache_sync (dev,sg_virt (sg), sg->length, direction); }/* Now for the API extensions over the pci_ one */
Signature · 1 line
1.9.1
Re: [PATCH v2 07/10] avr32: use for_each_sg()
Quoted 6 lines · Akinobu Mita
This replaces the plain loop over the sglist array with
for_each_sg()macro which consists ofsg_next()function calls. Since avr32 doesn't selectARCH_HAS_SG_CHAIN, it is not necessary to usefor_each_sg()in order to loop over each sg element. But this can help find problems with drivers that do not properly initialize their sg tables whenCONFIG_DEBUG_SGis enabled.
Nice
Quoted 4 lines
Signed-off-by Akinobu Mita <[email protected]>Cc Haavard Skinnemoen <[email protected]>Cc Hans-Christian Egtvedt <[email protected]>
Quoted 53 lines
---
* New patch from v2arch/avr32/include/asm/dma-mapping.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)arch/avr32/include/asm/dma-mapping.h +10
-9@@ -209,17 +209,18 @@ dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,* the same here. */ static inline int -dma_map_sg (struct device *dev,struct scatterlist *sg,int nents, +dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction) {int i; +struct scatterlist *sg; -for (i =0 ; i < nents; i++) { +for_each_sg (sglist, sg, nents, i) {char *virt; - sg[i].dma_address =page_to_bus (sg_page (&sg[i])) + sg[i].offset; - virt =sg_virt (&sg[i]); -dma_cache_sync (dev, virt, sg[i].length, direction); + sg->dma_address =page_to_bus (sg_page (sg)) + sg->offset; + virt =sg_virt (sg); +dma_cache_sync (dev, virt, sg->length, direction); }return nents;@@ -321,14 +322,14 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, }static inline void -dma_sync_sg_for_device (struct device *dev,struct scatterlist *sg, +dma_sync_sg_for_device (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction) {int i; +struct scatterlist *sg; -for (i =0 ; i < nents; i++) { -dma_cache_sync (dev,sg_virt (&sg[i]), sg[i].length, direction); - } +for_each_sg (sglist, sg, nents, i) +dma_cache_sync (dev,sg_virt (sg), sg->length, direction); }/* Now for the API extensions over the pci_ one */
Signature · 2 lines
mvh Hans-Christian Egtvedt
PATCH v2 8/10 powerpc: use for_each_sg()
In reply to Akinobu MitaThis replaces the plain loop over the sglist array with for_each_sg() macro which consists of sg_next() function calls. Since powerpc does select ARCH_HAS_SG_CHAIN, it is necessary to use for_each_sg() in order to loop over each sg element. This also help find problems with drivers that do not properly initialize their sg tables when CONFIG_DEBUG_SG is enabled.
---
* New patch from v2
arch/powerpc/kernel/vio.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/powerpc/kernel/vio.c +5 -5
@@ -557,11 +557,11 @@ static int vio_dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,struct vio_dev *viodev =to_vio_dev (dev);struct iommu_table *tbl;struct scatterlist *sgl; -int ret, count =0 ; +int ret, count;size_t alloc_size =0 ; tbl =get_iommu_table_base (dev); -for (sgl = sglist; count < nelems; count++, sgl++) +for_each_sg (sglist, sgl, nelems, count) alloc_size +=roundup (sgl->length,IOMMU_PAGE_SIZE (tbl));if (vio_cmo_alloc (viodev, alloc_size)) {
@@ -577,7 +577,7 @@ static int vio_dma_iommu_map_sg(struct device *dev, struct scatterlist *sglist,return ret; } -for (sgl = sglist, count =0 ; count < ret; count++, sgl++) +for_each_sg (sglist, sgl, ret, count) alloc_size -=roundup (sgl->dma_length,IOMMU_PAGE_SIZE (tbl));if (alloc_size)vio_cmo_dealloc (viodev, alloc_size);
@@ -594,10 +594,10 @@ static void vio_dma_iommu_unmap_sg(struct device *dev,struct iommu_table *tbl;struct scatterlist *sgl;size_t alloc_size =0 ; -int count =0 ; +int count; tbl =get_iommu_table_base (dev); -for (sgl = sglist; count < nelems; count++, sgl++) +for_each_sg (sglist, sgl, nelems, count) alloc_size +=roundup (sgl->dma_length,IOMMU_PAGE_SIZE (tbl)); dma_iommu_ops.unmap_sg (dev, sglist, nelems, direction, attrs);
Signature · 6 lines
1.9.1 _______________________________________________ Linuxppc-dev mailing list [email protected] https://lists.ozlabs.org/listinfo/linuxppc-dev
PATCH v2 9/10 sparc: use for_each_sg()
In reply to Akinobu MitaThis replaces the plain loop over the sglist array with for_each_sg() macro which consists of sg_next() function calls. Since sparc does select ARCH_HAS_SG_CHAIN, it is necessary to use for_each_sg() in order to loop over each sg element. This also help find problems with drivers that do not properly initialize their sg tables when CONFIG_DEBUG_SG is enabled.
---
* New patch from v2
arch/sparc/kernel/ldc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/sparc/kernel/ldc.c +5 -3
@@ -2086,6 +2086,7 @@ int ldc_map_sg(struct ldc_channel *lp,struct cookie_state state;struct ldc_iommu *iommu;int err; +struct scatterlist *s;if (map_perm & ~LDC_MAP_ALL )return -EINVAL ;
@@ -2112,9 +2113,10 @@ int ldc_map_sg(struct ldc_channel *lp, state.pte_idx = (base - iommu->page_table); state.nc =0 ; -for (i =0 ; i < num_sg; i++) -fill_cookies (&state,page_to_pfn (sg_page (&sg[i])) <<PAGE_SHIFT , - sg[i].offset, sg[i].length); +for_each_sg (sg, s, num_sg, i) { +fill_cookies (&state,page_to_pfn (sg_page (s)) <<PAGE_SHIFT , + s->offset, s->length); + }return state.nc; }
Signature · 1 line
1.9.1
PATCH v2 10/10 parisc: use for_each_sg()
In reply to Akinobu MitaThis replaces the plain loop over the sglist array with for_each_sg() macro which consists of sg_next() function calls. Since parisc doesn't select ARCH_HAS_SG_CHAIN, it is not necessary to use for_each_sg() in order to loop over each sg element. But this can help find problems with drivers that do not properly initialize their sg tables when CONFIG_DEBUG_SG is enabled.
---
* New patch from v2
arch/parisc/kernel/pci-dma.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-)
arch/parisc/kernel/pci-dma.c +16 -11
@@ -478,14 +478,16 @@ static void pa11_dma_unmap_single(struct device *dev, dma_addr_t dma_handle, sizstatic int pa11_dma_map_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction) {int i; +struct scatterlist *sg;BUG_ON (direction ==DMA_NONE ); -for (i =0 ; i < nents; i++, sglist++ ) { -unsigned long vaddr = (unsigned long )sg_virt (sglist); -sg_dma_address (sglist) = (dma_addr_t )virt_to_phys (vaddr); -sg_dma_len (sglist) = sglist->length; -flush_kernel_dcache_range (vaddr, sglist->length); +for_each_sg (sglist, sg, nents, i) { +unsigned long vaddr = (unsigned long )sg_virt (sg); + +sg_dma_address (sg) = (dma_addr_t )virt_to_phys (vaddr); +sg_dma_len (sg) = sg->length; +flush_kernel_dcache_range (vaddr, sg->length); }return nents; }
@@ -493,6 +495,7 @@ static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist, int nstatic void pa11_dma_unmap_sg (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction) {int i; +struct scatterlist *sg;BUG_ON (direction ==DMA_NONE );
@@ -501,8 +504,8 @@ static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, in/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */ -for (i =0 ; i < nents; i++, sglist++ ) -flush_kernel_vmap_range (sg_virt (sglist), sglist->length); +for_each_sg (sglist, sg, nents, i) +flush_kernel_vmap_range (sg_virt (sg), sg->length);return ; }
@@ -523,21 +526,23 @@ static void pa11_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_hstatic void pa11_dma_sync_sg_for_cpu (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction) {int i; +struct scatterlist *sg;/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */ -for (i =0 ; i < nents; i++, sglist++ ) -flush_kernel_vmap_range (sg_virt (sglist), sglist->length); +for_each_sg (sglist, sg, nents, i) +flush_kernel_vmap_range (sg_virt (sg), sg->length); }static void pa11_dma_sync_sg_for_device (struct device *dev,struct scatterlist *sglist,int nents,enum dma_data_direction direction) {int i; +struct scatterlist *sg;/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */ -for (i =0 ; i < nents; i++, sglist++ ) -flush_kernel_vmap_range (sg_virt (sglist), sglist->length); +for_each_sg (sglist, sg, nents, i) +flush_kernel_vmap_range (sg_virt (sg), sg->length); }struct hppa_dma_ops pcxl_dma_ops = {
Signature · 1 line
1.9.1
Quoted 7 lines · Akinobu Mita
This replaces the plain loop over the sglist array with
for_each_sg()macro which consists ofsg_next()function calls. Since m68k doesn't selectARCH_HAS_SG_CHAIN, it is not necessary to usefor_each_sg()in order to loop over each sg element. But this can help find problems with drivers that do not properly initialize their sg tables whenCONFIG_DEBUG_SGis enabled.
Quoted 8 lines
Signed-off-by Akinobu Mita <[email protected]>Cc Geert Uytterhoeven <[email protected]>---
* Changes from v1
- Update commit log
Thanks, applied, and queued for v4.2.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 7 lines · Akinobu Mita
This replaces the plain loop over the sglist array with
for_each_sg()macro which consists ofsg_next()function calls. Since m68k doesn't selectARCH_HAS_SG_CHAIN, it is not necessary to usefor_each_sg()in order to loop over each sg element. But this can help find problems with drivers that do not properly initialize their sg tables whenCONFIG_DEBUG_SGis enabled.
Quoted 8 lines
Signed-off-by Akinobu Mita <[email protected]>Cc Geert Uytterhoeven <[email protected]>---
* Changes from v1
- Update commit log
Thanks, applied, and queued for v4.2.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds