diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-09-25 16:05:02 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-09-25 18:39:24 -0400 |
commit | 01135d92c1a540cd3370f7cf3d1c762320b85034 (patch) | |
tree | a6344d942a4f63cba85290a93008ce211996d27d /arch/arm/mm/dma-mapping.c | |
parent | 56f55f8b58a02e95b401cb50df05086cabeaeeb5 (diff) |
[ARM] dma: Reduce to one dma_map_sg()/dma_unmap_sg() implementation
No point having two of these; dma_map_page() can do all the work
for us.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mm/dma-mapping.c')
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 7bf3e6fdfb57..c9c1206e358c 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c | |||
@@ -513,7 +513,6 @@ void dma_cache_maint(const void *start, size_t size, int direction) | |||
513 | } | 513 | } |
514 | EXPORT_SYMBOL(dma_cache_maint); | 514 | EXPORT_SYMBOL(dma_cache_maint); |
515 | 515 | ||
516 | #ifndef CONFIG_DMABOUNCE | ||
517 | /** | 516 | /** |
518 | * dma_map_sg - map a set of SG buffers for streaming mode DMA | 517 | * dma_map_sg - map a set of SG buffers for streaming mode DMA |
519 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | 518 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices |
@@ -534,16 +533,20 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, | |||
534 | enum dma_data_direction dir) | 533 | enum dma_data_direction dir) |
535 | { | 534 | { |
536 | struct scatterlist *s; | 535 | struct scatterlist *s; |
537 | int i; | 536 | int i, j; |
538 | 537 | ||
539 | for_each_sg(sg, s, nents, i) { | 538 | for_each_sg(sg, s, nents, i) { |
540 | s->dma_address = page_to_dma(dev, sg_page(s)) + s->offset; | 539 | s->dma_address = dma_map_page(dev, sg_page(s), s->offset, |
541 | 540 | s->length, dir); | |
542 | if (!arch_is_coherent()) | 541 | if (dma_mapping_error(dev, s->dma_address)) |
543 | dma_cache_maint(sg_virt(s), s->length, dir); | 542 | goto bad_mapping; |
544 | } | 543 | } |
545 | |||
546 | return nents; | 544 | return nents; |
545 | |||
546 | bad_mapping: | ||
547 | for_each_sg(sg, s, i, j) | ||
548 | dma_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir); | ||
549 | return 0; | ||
547 | } | 550 | } |
548 | EXPORT_SYMBOL(dma_map_sg); | 551 | EXPORT_SYMBOL(dma_map_sg); |
549 | 552 | ||
@@ -560,10 +563,15 @@ EXPORT_SYMBOL(dma_map_sg); | |||
560 | void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, | 563 | void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, |
561 | enum dma_data_direction dir) | 564 | enum dma_data_direction dir) |
562 | { | 565 | { |
563 | /* nothing to do */ | 566 | struct scatterlist *s; |
567 | int i; | ||
568 | |||
569 | for_each_sg(sg, s, nents, i) | ||
570 | dma_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir); | ||
564 | } | 571 | } |
565 | EXPORT_SYMBOL(dma_unmap_sg); | 572 | EXPORT_SYMBOL(dma_unmap_sg); |
566 | 573 | ||
574 | #ifndef CONFIG_DMABOUNCE | ||
567 | /** | 575 | /** |
568 | * dma_sync_sg_for_cpu | 576 | * dma_sync_sg_for_cpu |
569 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices | 577 | * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices |