linux_dsm_epyc7002/drivers/dma
Lars-Peter Clausen fdaf9c4b22 dmaengine: Use dma_sg_len(sg) instead of sg->length
sg->length may or may not contain the length of the dma region to transfer,
depending on the architecture - dma_sg_len(sg) always will though. For the
architectures which use the drivers modified by this patch it probably is the
case that sg->length contains the dma transfer length. But to be consistent and
future proof change them to use dma_sg_len.

To quote Russel King:
	sg->length is meaningless to something performing DMA.

	In cases where sg_dma_len(sg) and sg->length are the same storage, then
	there's no problem. But scatterlists _can_ (and one some architectures) do
	split them - especially when you have an IOMMU which can allow you to
	combine a scatterlist into fewer entries.

	So, anything using sg->length for the size of a scatterlist's DMA transfer
	_after_ a call to dma_map_sg() is almost certainly buggy.

The patch has been generated using the following coccinelle patch:
<smpl>
@@
struct scatterlist *sg;
expression X;
@@
-sg[X].length
+sg_dma_len(&sg[X])
@@
struct scatterlist *sg;
@@
-sg->length
+sg_dma_len(sg)
</smpl>

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
2012-05-11 12:04:38 +05:30
..
ioat dmaengine: fix for cookie changes and merge 2012-03-13 11:58:12 +05:30
ipu dmaengine: add context parameter to prep_slave_sg and prep_dma_cyclic 2012-03-21 19:20:23 +05:30
ppc4xx dmaengine: ensure all DMA engine drivers initialize their cookies 2012-03-13 11:37:42 +05:30
amba-pl08x.c dmaengine: Use dma_sg_len(sg) instead of sg->length 2012-05-11 12:04:38 +05:30
at_hdmac_regs.h dmaengine: at_hdmac: add slave config operation 2012-03-21 21:12:29 +05:30
at_hdmac.c dmaengine: at_hdmac: remove clear-on-read in atc_dostart() 2012-04-20 15:38:05 +05:30
coh901318_lli.c dmaengine: Use sg_dma_address instead of sg_phys 2012-05-11 12:04:38 +05:30
coh901318_lli.h dmaengine: move drivers to dma_transfer_direction 2011-10-27 20:53:43 +05:30
coh901318.c dmaengine: Use dma_sg_len(sg) instead of sg->length 2012-05-11 12:04:38 +05:30
dmaengine.c dma: dmaengine: Distinguish between 'dmaengine: failed to get' messages 2012-03-06 17:01:07 +05:30
dmaengine.h dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
dmatest.c dmaengine: fix missing 'cnt' in ?: in dmatest 2012-01-23 11:43:18 -08:00
dw_dmac_regs.h dmaengine: move last completed cookie into generic dma_chan structure 2012-03-13 11:36:06 +05:30
dw_dmac.c dmaengine: Use sg_dma_address instead of sg_phys 2012-05-11 12:04:38 +05:30
ep93xx_dma.c dmaengine: add context parameter to prep_slave_sg and prep_dma_cyclic 2012-03-21 19:20:23 +05:30
fsldma.c dmaengine: add context parameter to prep_slave_sg and prep_dma_cyclic 2012-03-21 19:20:23 +05:30
fsldma.h dmaengine: move last completed cookie into generic dma_chan structure 2012-03-13 11:36:06 +05:30
imx-dma.c dmaengine: Use dma_sg_len(sg) instead of sg->length 2012-05-11 12:04:38 +05:30
imx-sdma.c dmaengine: Use dma_sg_len(sg) instead of sg->length 2012-05-11 12:04:38 +05:30
intel_mid_dma_regs.h dmaengine: move last completed cookie into generic dma_chan structure 2012-03-13 11:36:06 +05:30
intel_mid_dma.c dmaengine: Use dma_sg_len(sg) instead of sg->length 2012-05-11 12:04:38 +05:30
iop-adma.c Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma 2012-03-29 15:34:57 -07:00
iovlock.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
Kconfig Merge branch 'next' of git://git.infradead.org/users/vkoul/slave-dma 2012-03-29 15:34:57 -07:00
Makefile DMA: sa11x0: add SA-11x0 DMA driver 2012-03-07 11:32:21 +00:00
mpc512x_dma.c dmaengine: consolidate initialization of cookies 2012-03-13 11:37:22 +05:30
mv_xor.c dmaengine: ensure all DMA engine drivers initialize their cookies 2012-03-13 11:37:42 +05:30
mv_xor.h dmaengine: move last completed cookie into generic dma_chan structure 2012-03-13 11:36:06 +05:30
mxs-dma.c dmaengine: Use dma_sg_len(sg) instead of sg->length 2012-05-11 12:04:38 +05:30
pch_dma.c dmaengine: Use sg_dma_address instead of sg_phys 2012-05-11 12:04:38 +05:30
pl330.c DMA: PL330: Remove duplicate header file inclusion 2012-05-11 11:58:15 +05:30
sa11x0-dma.c DMA: sa11x0: add SA-11x0 DMA driver 2012-03-07 11:32:21 +00:00
shdma.c dmaengine: add context parameter to prep_slave_sg and prep_dma_cyclic 2012-03-21 19:20:23 +05:30
shdma.h dmaengine: move last completed cookie into generic dma_chan structure 2012-03-13 11:36:06 +05:30
sirf-dma.c dmaengine: add context parameter to prep_slave_sg and prep_dma_cyclic 2012-03-21 19:20:23 +05:30
ste_dma40_ll.c dma40: cyclic xfer support 2011-01-30 22:27:21 -08:00
ste_dma40_ll.h dma40: Improve the logic of stopping logical chan 2012-04-23 17:56:17 +05:30
ste_dma40.c dmaengine: Use dma_sg_len(sg) instead of sg->length 2012-05-11 12:04:38 +05:30
timb_dma.c dmaengine: add context parameter to prep_slave_sg and prep_dma_cyclic 2012-03-21 19:20:23 +05:30
TODO dmaengine: remove ste_dma40 from issue_pending TODO 2011-07-14 04:02:08 +05:30
txx9dmac.c dmaengine: add context parameter to prep_slave_sg and prep_dma_cyclic 2012-03-21 19:20:23 +05:30
txx9dmac.h dmaengine: move last completed cookie into generic dma_chan structure 2012-03-13 11:36:06 +05:30