]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
alpha: fix sg_page breakage
authorFUJITA Tomonori <tomof@acm.org>
Wed, 21 Nov 2007 11:26:31 +0000 (12:26 +0100)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 27 Nov 2007 08:19:39 +0000 (09:19 +0100)
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
arch/alpha/kernel/pci-noop.c

index 174b729c504b274084c10bd78ff9e4465f3a9cda..468b76ce66a1304e4eeddc48663effbe8545f83e 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/dma-mapping.h>
+#include <linux/scatterlist.h>
 
 #include "proto.h"
 
@@ -172,18 +173,19 @@ dma_alloc_coherent(struct device *dev, size_t size,
 EXPORT_SYMBOL(dma_alloc_coherent);
 
 int
-dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
+dma_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
           enum dma_data_direction direction)
 {
        int i;
+       struct scatterlist *sg;
 
-       for (i = 0; i < nents; i++ ) {
+       for_each_sg(sgl, sg, nents, i) {
                void *va;
 
-               BUG_ON(!sg[i].page);
-               va = page_address(sg[i].page) + sg[i].offset;
-               sg_dma_address(sg + i) = (dma_addr_t)virt_to_bus(va);
-               sg_dma_len(sg + i) = sg[i].length;
+               BUG_ON(!sg_page(sg));
+               va = sg_virt(sg);
+               sg_dma_address(sg) = (dma_addr_t)virt_to_bus(va);
+               sg_dma_len(sg) = sg->length;
        }
 
        return nents;