x86-64: update nommu to sg helpers
authorJens Axboe <jens.axboe@oracle.com>
Tue, 24 Jul 2007 10:39:27 +0000 (12:39 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 16 Oct 2007 09:26:02 +0000 (11:26 +0200)
Acked-by: Muli Ben-Yehuda <muli@il.ibm.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
arch/x86/kernel/pci-nommu_64.c

index 2a34c6c025a920832455dc0c32c4978ee5881ee0..e85d4360360c68fe6db2166194e8a748f709f1f2 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/pci.h>
 #include <linux/string.h>
 #include <linux/dma-mapping.h>
+#include <linux/scatterlist.h>
 
 #include <asm/iommu.h>
 #include <asm/processor.h>
@@ -57,10 +58,10 @@ static void nommu_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
 static int nommu_map_sg(struct device *hwdev, struct scatterlist *sg,
               int nents, int direction)
 {
+       struct scatterlist *s;
        int i;
 
-       for (i = 0; i < nents; i++ ) {
-               struct scatterlist *s = &sg[i];
+       for_each_sg(sg, s, nents, i) {
                BUG_ON(!s->page);
                s->dma_address = virt_to_bus(page_address(s->page) +s->offset);
                if (!check_addr("map_sg", hwdev, s->dma_address, s->length))