diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2008-09-25 21:59:12 +0200 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-09-26 00:39:24 +0200 |
commit | 56f55f8b58a02e95b401cb50df05086cabeaeeb5 (patch) | |
tree | 3be7e3383157c731178ca447008c0e7c236bfbfc /arch/arm/include/asm/dma-mapping.h | |
parent | [ARM] Update dma_map_sg()/dma_unmap_sg() API (diff) | |
download | linux-56f55f8b58a02e95b401cb50df05086cabeaeeb5.tar.xz linux-56f55f8b58a02e95b401cb50df05086cabeaeeb5.zip |
[ARM] dma: provide a better dma_map_page() implementation
We can translate a struct page directly to a DMA address using
page_to_dma(). No need to use page_address() followed by
virt_to_dma().
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/include/asm/dma-mapping.h')
-rw-r--r-- | arch/arm/include/asm/dma-mapping.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index eff954852c2b..856ee1bdee57 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -227,13 +227,22 @@ extern dma_addr_t dma_map_single(struct device *,void *, size_t, enum dma_data_d * can regain ownership by calling dma_unmap_page() or * dma_sync_single_for_cpu(). */ +#ifndef CONFIG_DMABOUNCE static inline dma_addr_t dma_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir) { - return dma_map_single(dev, page_address(page) + offset, size, dir); + if (!arch_is_coherent()) + dma_cache_maint(page_address(page) + offset, size, dir); + + return page_to_dma(dev, page) + offset; } +#else +extern dma_addr_t dma_map_page(struct device *dev, struct page *page, + unsigned long offset, size_t size, + enum dma_data_direction dir); +#endif /** * dma_unmap_single - unmap a single buffer previously mapped |