[PATCH 2/3] ARM:dma-mapping:only provide one set of dma-api wrappers

From: tom . leiming
Date: Sat Jul 11 2009 - 12:08:41 EST


From: Ming Lei <tom.leiming@xxxxxxxxx>


Signed-off-by: Ming Lei <tom.leiming@xxxxxxxxx>
---
arch/arm/include/asm/dma-mapping.h | 53 +++++++++++++++++-------------------
1 files changed, 25 insertions(+), 28 deletions(-)

diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 0e87498..86f2964 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -273,22 +273,6 @@ extern dma_addr_t __dma_map_page(struct device *, struct page *,
extern void __dma_unmap_single(struct device *, dma_addr_t, size_t,
enum dma_data_direction);

-static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
- size_t size, enum dma_data_direction dir)
-{
- return __dma_map_single(dev, cpu_addr, size, dir);
-}
-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_page(dev, page, offset, size, dir);
-}
-static inline void dma_unmap_single(struct device *dev, dma_addr_t handle,
- size_t size, enum dma_data_direction dir)
-{
- __dma_unmap_single(dev, handle, size, dir);
-}
-
/*
* Private functions
*/
@@ -309,6 +293,28 @@ static inline int dmabounce_sync_for_device(struct device *d, dma_addr_t addr,
return 1;
}

+static inline dma_addr_t __dma_map_single(struct device *dev, void *cpu_addr,
+ size_t size, enum dma_data_direction dir)
+{
+ if (!arch_is_coherent())
+ dma_cache_maint(cpu_addr, size, dir);
+
+ return virt_to_dma(dev, cpu_addr);
+}
+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)
+{
+ if (!arch_is_coherent())
+ dma_cache_maint_page(page, offset, size, dir);
+
+ return page_to_dma(dev, page) + offset;
+}
+static inline void __dma_unmap_single(struct device *dev, dma_addr_t handle,
+ size_t size, enum dma_data_direction dir)
+{
+ /* nothing to do */
+}
+#endif /* CONFIG_DMABOUNCE */

/**
* dma_map_single - map a single buffer for streaming DMA
@@ -328,11 +334,7 @@ static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
size_t size, enum dma_data_direction dir)
{
BUG_ON(!valid_dma_direction(dir));
-
- if (!arch_is_coherent())
- dma_cache_maint(cpu_addr, size, dir);
-
- return virt_to_dma(dev, cpu_addr);
+ return __dma_map_single(dev, cpu_addr, size, dir);
}

/**
@@ -353,11 +355,7 @@ 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)
{
BUG_ON(!valid_dma_direction(dir));
-
- if (!arch_is_coherent())
- dma_cache_maint_page(page, offset, size, dir);
-
- return page_to_dma(dev, page) + offset;
+ return __dma_map_page(dev, page, offset, size, dir);
}

/**
@@ -377,9 +375,8 @@ static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
static inline void dma_unmap_single(struct device *dev, dma_addr_t handle,
size_t size, enum dma_data_direction dir)
{
- /* nothing to do */
+ __dma_unmap_single(dev, handle, size, dir);
}
-#endif /* CONFIG_DMABOUNCE */

/**
* dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
--
1.6.0.GIT

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/