summaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel/dma-mapping.c
diff options
context:
space:
mode:
authorSonic Zhang <sonic.zhang@analog.com>2012-05-22 12:23:40 +0200
committerBob Liu <lliubbo@gmail.com>2012-07-24 07:39:48 +0200
commit86d688a3c370093f978c7ced9b510944301fc9d4 (patch)
tree8cce56eaa8994c2af8108af887939e712bb7061f /arch/blackfin/kernel/dma-mapping.c
parentbfin: add 32M, 16M and 8M uncached DMA region options (diff)
downloadlinux-86d688a3c370093f978c7ced9b510944301fc9d4.tar.xz
linux-86d688a3c370093f978c7ced9b510944301fc9d4.zip
blackfin: Call sg_for_each to pass through the whole sg list.
Otherwise, chained sg list may be missed. Signed-off-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Bob Liu <lliubbo@gmail.com>
Diffstat (limited to 'arch/blackfin/kernel/dma-mapping.c')
-rw-r--r--arch/blackfin/kernel/dma-mapping.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/blackfin/kernel/dma-mapping.c b/arch/blackfin/kernel/dma-mapping.c
index f0d1118f1825..e7be6532d6a0 100644
--- a/arch/blackfin/kernel/dma-mapping.c
+++ b/arch/blackfin/kernel/dma-mapping.c
@@ -122,12 +122,13 @@ void __dma_sync(dma_addr_t addr, size_t size,
EXPORT_SYMBOL(__dma_sync);
int
-dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
+dma_map_sg(struct device *dev, struct scatterlist *sg_list, int nents,
enum dma_data_direction direction)
{
+ struct scatterlist *sg;
int i;
- for (i = 0; i < nents; i++, sg++) {
+ for_each_sg(sg_list, sg, nents, i) {
sg->dma_address = (dma_addr_t) sg_virt(sg);
__dma_sync(sg_dma_address(sg), sg_dma_len(sg), direction);
}
@@ -136,12 +137,13 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
}
EXPORT_SYMBOL(dma_map_sg);
-void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
+void dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg_list,
int nelems, enum dma_data_direction direction)
{
+ struct scatterlist *sg;
int i;
- for (i = 0; i < nelems; i++, sg++) {
+ for_each_sg(sg_list, sg, nelems, i) {
sg->dma_address = (dma_addr_t) sg_virt(sg);
__dma_sync(sg_dma_address(sg), sg_dma_len(sg), direction);
}