aboutsummaryrefslogtreecommitdiffstats
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 aecc6c3f908f..35c72bcf3d0b 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -435,6 +435,7 @@ int
435dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 435dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
436 enum dma_data_direction dir) 436 enum dma_data_direction dir)
437{ 437{
438 struct scatterlist *s;
438 int i; 439 int i;
439 440
440 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n", 441 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,
442 443
443 BUG_ON(dir == DMA_NONE); 444 BUG_ON(dir == DMA_NONE);
444 445
445 for (i = 0; i < nents; i++, sg++) { 446 for_each_sg(sg, s, nents, i) {
446 struct page *page = sg_page(sg); 447 struct page *page = sg_page(s);
447 unsigned int offset = sg->offset; 448 unsigned int offset = s->offset;
448 unsigned int length = sg->length; 449 unsigned int length = s->length;
449 void *ptr = page_address(page) + offset; 450 void *ptr = page_address(page) + offset;
450 451
451 sg->dma_address = 452 s->dma_address = map_single(dev, ptr, length, dir);
452 map_single(dev, ptr, length, dir);
453 } 453 }
454 454
455 return nents; 455 return nents;
@@ -459,6 +459,7 @@ void
459dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, 459dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
460 enum dma_data_direction dir) 460 enum dma_data_direction dir)
461{ 461{
462 struct scatterlist *s;
462 int i; 463 int i;
463 464
464 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n", 465 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,
466 467
467 BUG_ON(dir == DMA_NONE); 468 BUG_ON(dir == DMA_NONE);
468 469
469 for (i = 0; i < nents; i++, sg++) { 470 for_each_sg(sg, s, nents, i) {
470 dma_addr_t dma_addr = sg->dma_address; 471 dma_addr_t dma_addr = s->dma_address;
471 unsigned int length = sg->length; 472 unsigned int length = s->length;
472 473
473 unmap_single(dev, dma_addr, length, dir); 474 unmap_single(dev, dma_addr, length, dir);
474 } 475 }
@@ -502,6 +503,7 @@ void
502dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents, 503dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
503 enum dma_data_direction dir) 504 enum dma_data_direction dir)
504{ 505{
506 struct scatterlist *s;
505 int i; 507 int i;
506 508
507 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n", 509 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,
509 511
510 BUG_ON(dir == DMA_NONE); 512 BUG_ON(dir == DMA_NONE);
511 513
512 for (i = 0; i < nents; i++, sg++) { 514 for_each_sg(sg, s, nents, i) {
513 dma_addr_t dma_addr = sg->dma_address; 515 dma_addr_t dma_addr = s->dma_address;
514 unsigned int length = sg->length; 516 unsigned int length = s->length;
515 517
516 sync_single(dev, dma_addr, length, dir); 518 sync_single(dev, dma_addr, length, dir);
517 } 519 }
@@ -521,6 +523,7 @@ void
521dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents, 523dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents,
522 enum dma_data_direction dir) 524 enum dma_data_direction dir)
523{ 525{
526 struct scatterlist *s;
524 int i; 527 int i;
525 528
526 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n", 529 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,
528 531
529 BUG_ON(dir == DMA_NONE); 532 BUG_ON(dir == DMA_NONE);
530 533
531 for (i = 0; i < nents; i++, sg++) { 534 for_each_sg(sg, s, nents, i) {
532 dma_addr_t dma_addr = sg->dma_address; 535 dma_addr_t dma_addr = s->dma_address;
533 unsigned int length = sg->length; 536 unsigned int length = s->length;
534 537
535 sync_single(dev, dma_addr, length, dir); 538 sync_single(dev, dma_addr, length, dir);
536 } 539 }