From: Sonic Zhang Date: Thu, 12 Jul 2007 04:18:08 +0000 (+0800) Subject: Blackfin arch: fix bug set dma_address properly in dma_map_sg X-Git-Tag: v2.6.23-rc1~1111^2~11 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b07af760c9bd8e87c3aa9275298566379ec4e9c1;p=linux-2.6 Blackfin arch: fix bug set dma_address properly in dma_map_sg Signed-off-by: Sonic Zhang Signed-off-by: Bryan Wu --- diff --git a/arch/blackfin/kernel/dma-mapping.c b/arch/blackfin/kernel/dma-mapping.c index bda57ec881..ea48d5b13f 100644 --- a/arch/blackfin/kernel/dma-mapping.c +++ b/arch/blackfin/kernel/dma-mapping.c @@ -159,10 +159,13 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, BUG_ON(direction == DMA_NONE); - for (i = 0; i < nents; i++) - invalidate_dcache_range(sg_dma_address(&sg[i]), - sg_dma_address(&sg[i]) + - sg_dma_len(&sg[i])); + for (i = 0; i < nents; i++, sg++) { + sg->dma_address = page_address(sg->page) + sg->offset; + + invalidate_dcache_range(sg_dma_address(sg), + sg_dma_address(sg) + + sg_dma_len(sg)); + } return nents; }