summaryrefslogtreecommitdiffstats
path: root/arch/arm/common
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-09-25 16:30:57 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-09-25 20:48:45 +0100
commitafd1a321c49a250dab97cef6f2d3c3c9b9d0174a (patch)
tree7468c0055b088df5456cb2fa40d27f6c4f2e1732 /arch/arm/common
parent0ddbccd1187e12bf77e1f19d8b9dec700e09e734 (diff)
downloadlinux-afd1a321c49a250dab97cef6f2d3c3c9b9d0174a.tar.bz2
[ARM] Update dma_map_sg()/dma_unmap_sg() API
Update the ARM DMA scatter gather APIs for the scatterlist changes. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/common')
-rw-r--r--arch/arm/common/dmabounce.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
index aecc6c3f908f..35c72bcf3d0b 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -435,6 +435,7 @@ int
dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction dir)
{
+ struct scatterlist *s;
int i;
dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n",
@@ -442,14 +443,13 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
BUG_ON(dir == DMA_NONE);
- for (i = 0; i < nents; i++, sg++) {
- struct page *page = sg_page(sg);
- unsigned int offset = sg->offset;
- unsigned int length = sg->length;
+ for_each_sg(sg, s, nents, i) {
+ struct page *page = sg_page(s);
+ unsigned int offset = s->offset;
+ unsigned int length = s->length;
void *ptr = page_address(page) + offset;
- sg->dma_address =
- map_single(dev, ptr, length, dir);
+ s->dma_address = map_single(dev, ptr, length, dir);
}
return nents;
@@ -459,6 +459,7 @@ void
dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction dir)
{
+ struct scatterlist *s;
int i;
dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n",
@@ -466,9 +467,9 @@ dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
BUG_ON(dir == DMA_NONE);
- for (i = 0; i < nents; i++, sg++) {
- dma_addr_t dma_addr = sg->dma_address;
- unsigned int length = sg->length;
+ for_each_sg(sg, s, nents, i) {
+ dma_addr_t dma_addr = s->dma_address;
+ unsigned int length = s->length;
unmap_single(dev, dma_addr, length, dir);
}
@@ -502,6 +503,7 @@ void
dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction dir)
{
+ struct scatterlist *s;
int i;
dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n",
@@ -509,9 +511,9 @@ dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
BUG_ON(dir == DMA_NONE);
- for (i = 0; i < nents; i++, sg++) {
- dma_addr_t dma_addr = sg->dma_address;
- unsigned int length = sg->length;
+ for_each_sg(sg, s, nents, i) {
+ dma_addr_t dma_addr = s->dma_address;
+ unsigned int length = s->length;
sync_single(dev, dma_addr, length, dir);
}
@@ -521,6 +523,7 @@ void
dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction dir)
{
+ struct scatterlist *s;
int i;
dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n",
@@ -528,9 +531,9 @@ dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
BUG_ON(dir == DMA_NONE);
- for (i = 0; i < nents; i++, sg++) {
- dma_addr_t dma_addr = sg->dma_address;
- unsigned int length = sg->length;
+ for_each_sg(sg, s, nents, i) {
+ dma_addr_t dma_addr = s->dma_address;
+ unsigned int length = s->length;
sync_single(dev, dma_addr, length, dir);
}