intel-iommu: fix sg_page()
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tue, 23 Oct 2007 07:32:25 +0000 (09:32 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Tue, 23 Oct 2007 07:49:33 +0000 (09:49 +0200)
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
drivers/pci/intel-iommu.c

index b3d70310af4907a449c2b5751589c1591c25f25a..0c4ab3b07274c466b157b9dd37b38e6e4ed8c0cd 100644 (file)
@@ -1962,7 +1962,7 @@ static void intel_free_coherent(struct device *hwdev, size_t size,
        free_pages((unsigned long)vaddr, order);
 }
 
-#define SG_ENT_VIRT_ADDRESS(sg)        (page_address((sg)->page) + (sg)->offset)
+#define SG_ENT_VIRT_ADDRESS(sg)        (sg_virt((sg)))
 static void intel_unmap_sg(struct device *hwdev, struct scatterlist *sglist,
        int nelems, int dir)
 {
@@ -2010,7 +2010,7 @@ static int intel_nontranslate_map_sg(struct device *hddev,
        struct scatterlist *sg;
 
        for_each_sg(sglist, sg, nelems, i) {
-               BUG_ON(!sg->page);
+               BUG_ON(!sg_page(sg));
                sg->dma_address = virt_to_bus(SG_ENT_VIRT_ADDRESS(sg));
                sg->dma_length = sg->length;
        }