aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/common
diff options
context:
space:
mode:
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 aecc6c3f908..35c72bcf3d0 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);
}