aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/common/dmabounce.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2008-09-25 16:38:41 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-09-29 05:40:16 -0400
commit2638b4dbe768aba023a06acd8e7eba708bb76ee6 (patch)
tree41e464b337ec85444d8c551947de13bb8731af70 /arch/arm/common/dmabounce.c
parent01135d92c1a540cd3370f7cf3d1c762320b85034 (diff)
[ARM] dma: Reduce to one dma_sync_sg_* implementation
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/common/dmabounce.c')
-rw-r--r--arch/arm/common/dmabounce.c48
1 files changed, 12 insertions, 36 deletions
diff --git a/arch/arm/common/dmabounce.c b/arch/arm/common/dmabounce.c
index 20d967376fa9..0a98148279b1 100644
--- a/arch/arm/common/dmabounce.c
+++ b/arch/arm/common/dmabounce.c
@@ -468,45 +468,23 @@ void dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_addr,
468} 468}
469EXPORT_SYMBOL(dma_sync_single_range_for_device); 469EXPORT_SYMBOL(dma_sync_single_range_for_device);
470 470
471void 471int dmabounce_sync_for_cpu(struct device *dev, dma_addr_t addr,
472dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents, 472 unsigned long off, size_t sz, enum dma_data_direction dir)
473 enum dma_data_direction dir)
474{ 473{
475 struct scatterlist *s; 474 dev_dbg(dev, "%s(dma=%#lx,off=%#lx,sz=%zx,dir=%x)\n",
476 int i; 475 __func__, addr, off, sz, dir);
477 476 return sync_single(dev, addr, off + sz, dir);
478 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n",
479 __func__, sg, nents, dir);
480
481 BUG_ON(dir == DMA_NONE);
482
483 for_each_sg(sg, s, nents, i) {
484 dma_addr_t dma_addr = s->dma_address;
485 unsigned int length = s->length;
486
487 sync_single(dev, dma_addr, length, dir);
488 }
489} 477}
478EXPORT_SYMBOL(dmabounce_sync_for_cpu);
490 479
491void 480int dmabounce_sync_for_device(struct device *dev, dma_addr_t addr,
492dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nents, 481 unsigned long off, size_t sz, enum dma_data_direction dir)
493 enum dma_data_direction dir)
494{ 482{
495 struct scatterlist *s; 483 dev_dbg(dev, "%s(dma=%#lx,off=%#lx,sz=%zx,dir=%x)\n",
496 int i; 484 __func__, addr, off, sz, dir);
497 485 return sync_single(dev, addr, off + sz, dir);
498 dev_dbg(dev, "%s(sg=%p,nents=%d,dir=%x)\n",
499 __func__, sg, nents, dir);
500
501 BUG_ON(dir == DMA_NONE);
502
503 for_each_sg(sg, s, nents, i) {
504 dma_addr_t dma_addr = s->dma_address;
505 unsigned int length = s->length;
506
507 sync_single(dev, dma_addr, length, dir);
508 }
509} 486}
487EXPORT_SYMBOL(dmabounce_sync_for_device);
510 488
511static int 489static int
512dmabounce_init_pool(struct dmabounce_pool *pool, struct device *dev, const char *name, 490dmabounce_init_pool(struct dmabounce_pool *pool, struct device *dev, const char *name,
@@ -618,8 +596,6 @@ dmabounce_unregister_dev(struct device *dev)
618 596
619EXPORT_SYMBOL(dma_map_single); 597EXPORT_SYMBOL(dma_map_single);
620EXPORT_SYMBOL(dma_unmap_single); 598EXPORT_SYMBOL(dma_unmap_single);
621EXPORT_SYMBOL(dma_sync_sg_for_cpu);
622EXPORT_SYMBOL(dma_sync_sg_for_device);
623EXPORT_SYMBOL(dmabounce_register_dev); 599EXPORT_SYMBOL(dmabounce_register_dev);
624EXPORT_SYMBOL(dmabounce_unregister_dev); 600EXPORT_SYMBOL(dmabounce_unregister_dev);
625 601