lkml.org 
[lkml]   [2009]   [Jul]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] ARM:dma-mapping:only provide one set of dma-api wrappers
Date
From: Ming Lei <tom.leiming@gmail.com>


Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
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


\
 
 \ /
  Last update: 2009-07-11 18:11    [W:0.073 / U:2.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site