aboutsummaryrefslogtreecommitdiffstats
path: root/lib/dma-debug.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2009-05-26 20:43:02 -0400
committerJoerg Roedel <joerg.roedel@amd.com>2009-05-29 08:26:55 -0400
commit884d05970bfbc3db368f23460dc4ce63257f240d (patch)
treed4dbd2376fc75baf5312e30799e5937e68da9746 /lib/dma-debug.c
parent15aedea439c4d7dbec17c99b5e1594c01b979833 (diff)
dma-debug: use sg_dma_len accessor
debug_dma_map_sg() and debug_dma_unmap_sg() use length in struct scatterlist while debug_dma_sync_sg_for_cpu() and debug_dma_sync_sg_for_device() use dma_length. This causes bugs warnings on some IOMMU implementations since these values are not same; the length doesn't represent the dma length. We always need to use sg_dma_len() accessor to get the dma length of a scatterlist entry. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'lib/dma-debug.c')
-rw-r--r--lib/dma-debug.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 1b5bb82f106a..51f95e5b6265 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -839,7 +839,7 @@ void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
839 entry->type = dma_debug_sg; 839 entry->type = dma_debug_sg;
840 entry->dev = dev; 840 entry->dev = dev;
841 entry->paddr = sg_phys(s); 841 entry->paddr = sg_phys(s);
842 entry->size = s->length; 842 entry->size = sg_dma_len(s);
843 entry->dev_addr = sg_dma_address(s); 843 entry->dev_addr = sg_dma_address(s);
844 entry->direction = direction; 844 entry->direction = direction;
845 entry->sg_call_ents = nents; 845 entry->sg_call_ents = nents;
@@ -847,7 +847,7 @@ void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
847 847
848 if (!PageHighMem(sg_page(s))) { 848 if (!PageHighMem(sg_page(s))) {
849 check_for_stack(dev, sg_virt(s)); 849 check_for_stack(dev, sg_virt(s));
850 check_for_illegal_area(dev, sg_virt(s), s->length); 850 check_for_illegal_area(dev, sg_virt(s), sg_dma_len(s));
851 } 851 }
852 852
853 add_dma_entry(entry); 853 add_dma_entry(entry);
@@ -873,7 +873,7 @@ void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
873 .dev = dev, 873 .dev = dev,
874 .paddr = sg_phys(s), 874 .paddr = sg_phys(s),
875 .dev_addr = sg_dma_address(s), 875 .dev_addr = sg_dma_address(s),
876 .size = s->length, 876 .size = sg_dma_len(s),
877 .direction = dir, 877 .direction = dir,
878 .sg_call_ents = 0, 878 .sg_call_ents = 0,
879 }; 879 };
@@ -996,7 +996,7 @@ void debug_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
996 return; 996 return;
997 997
998 for_each_sg(sg, s, nelems, i) { 998 for_each_sg(sg, s, nelems, i) {
999 check_sync(dev, sg_dma_address(s), s->dma_length, 0, 999 check_sync(dev, sg_dma_address(s), sg_dma_len(s), 0,
1000 direction, true); 1000 direction, true);
1001 } 1001 }
1002} 1002}
@@ -1012,7 +1012,7 @@ void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
1012 return; 1012 return;
1013 1013
1014 for_each_sg(sg, s, nelems, i) { 1014 for_each_sg(sg, s, nelems, i) {
1015 check_sync(dev, sg_dma_address(s), s->dma_length, 0, 1015 check_sync(dev, sg_dma_address(s), sg_dma_len(s), 0,
1016 direction, false); 1016 direction, false);
1017 } 1017 }
1018} 1018}