summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2009-05-27 09:43:02 +0900
committerJoerg Roedel <joerg.roedel@amd.com>2009-05-29 14:26:55 +0200
commit884d05970bfbc3db368f23460dc4ce63257f240d (patch)
treed4dbd2376fc75baf5312e30799e5937e68da9746 /lib
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')
-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 1b5bb82f106..51f95e5b626 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,
entry->type = dma_debug_sg;
entry->dev = dev;
entry->paddr = sg_phys(s);
- entry->size = s->length;
+ entry->size = sg_dma_len(s);
entry->dev_addr = sg_dma_address(s);
entry->direction = direction;
entry->sg_call_ents = nents;
@@ -847,7 +847,7 @@ void debug_dma_map_sg(struct device *dev, struct scatterlist *sg,
if (!PageHighMem(sg_page(s))) {
check_for_stack(dev, sg_virt(s));
- check_for_illegal_area(dev, sg_virt(s), s->length);
+ check_for_illegal_area(dev, sg_virt(s), sg_dma_len(s));
}
add_dma_entry(entry);
@@ -873,7 +873,7 @@ void debug_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
.dev = dev,
.paddr = sg_phys(s),
.dev_addr = sg_dma_address(s),
- .size = s->length,
+ .size = sg_dma_len(s),
.direction = dir,
.sg_call_ents = 0,
};
@@ -996,7 +996,7 @@ void debug_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
return;
for_each_sg(sg, s, nelems, i) {
- check_sync(dev, sg_dma_address(s), s->dma_length, 0,
+ check_sync(dev, sg_dma_address(s), sg_dma_len(s), 0,
direction, true);
}
}
@@ -1012,7 +1012,7 @@ void debug_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
return;
for_each_sg(sg, s, nelems, i) {
- check_sync(dev, sg_dma_address(s), s->dma_length, 0,
+ check_sync(dev, sg_dma_address(s), sg_dma_len(s), 0,
direction, false);
}
}