aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2012-02-13 04:31:31 -0500
committerMarek Szyprowski <m.szyprowski@samsung.com>2012-03-28 10:36:40 -0400
commit77345520c465ccb85e4ed2c8ba352a159f60c2e4 (patch)
tree28e2b03fcd9de2c18abed51a393fcf29aab0bc69
parentffc4a3faf74f00b568393b83e08104c70f33869c (diff)
Hexagon: adapt for dma_map_ops changes
Adapt core Hexagon architecture code for dma_map_ops changes: replace alloc/free_coherent with generic alloc/free methods. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Richard Kuo <rkuo@codeaurora.org>
-rw-r--r--arch/hexagon/include/asm/dma-mapping.h18
-rw-r--r--arch/hexagon/kernel/dma.c9
2 files changed, 17 insertions, 10 deletions
diff --git a/arch/hexagon/include/asm/dma-mapping.h b/arch/hexagon/include/asm/dma-mapping.h
index 448b224ba4ef..233ed3d2d25e 100644
--- a/arch/hexagon/include/asm/dma-mapping.h
+++ b/arch/hexagon/include/asm/dma-mapping.h
@@ -71,29 +71,35 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
71 return (dma_addr == bad_dma_address); 71 return (dma_addr == bad_dma_address);
72} 72}
73 73
74static inline void *dma_alloc_coherent(struct device *dev, size_t size, 74#define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL)
75 dma_addr_t *dma_handle, gfp_t flag) 75
76static inline void *dma_alloc_attrs(struct device *dev, size_t size,
77 dma_addr_t *dma_handle, gfp_t flag,
78 struct dma_attrs *attrs)
76{ 79{
77 void *ret; 80 void *ret;
78 struct dma_map_ops *ops = get_dma_ops(dev); 81 struct dma_map_ops *ops = get_dma_ops(dev);
79 82
80 BUG_ON(!dma_ops); 83 BUG_ON(!dma_ops);
81 84
82 ret = ops->alloc_coherent(dev, size, dma_handle, flag); 85 ret = ops->alloc(dev, size, dma_handle, flag, attrs);
83 86
84 debug_dma_alloc_coherent(dev, size, *dma_handle, ret); 87 debug_dma_alloc_coherent(dev, size, *dma_handle, ret);
85 88
86 return ret; 89 return ret;
87} 90}
88 91
89static inline void dma_free_coherent(struct device *dev, size_t size, 92#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL)
90 void *cpu_addr, dma_addr_t dma_handle) 93
94static inline void dma_free_attrs(struct device *dev, size_t size,
95 void *cpu_addr, dma_addr_t dma_handle,
96 struct dma_attrs *attrs)
91{ 97{
92 struct dma_map_ops *dma_ops = get_dma_ops(dev); 98 struct dma_map_ops *dma_ops = get_dma_ops(dev);
93 99
94 BUG_ON(!dma_ops); 100 BUG_ON(!dma_ops);
95 101
96 dma_ops->free_coherent(dev, size, cpu_addr, dma_handle); 102 dma_ops->free(dev, size, cpu_addr, dma_handle, attrs);
97 103
98 debug_dma_free_coherent(dev, size, cpu_addr, dma_handle); 104 debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
99} 105}
diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c
index e711ace62fdf..37302218ca4a 100644
--- a/arch/hexagon/kernel/dma.c
+++ b/arch/hexagon/kernel/dma.c
@@ -54,7 +54,8 @@ static struct gen_pool *coherent_pool;
54/* Allocates from a pool of uncached memory that was reserved at boot time */ 54/* Allocates from a pool of uncached memory that was reserved at boot time */
55 55
56void *hexagon_dma_alloc_coherent(struct device *dev, size_t size, 56void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
57 dma_addr_t *dma_addr, gfp_t flag) 57 dma_addr_t *dma_addr, gfp_t flag,
58 struct dma_attrs *attrs)
58{ 59{
59 void *ret; 60 void *ret;
60 61
@@ -81,7 +82,7 @@ void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
81} 82}
82 83
83static void hexagon_free_coherent(struct device *dev, size_t size, void *vaddr, 84static void hexagon_free_coherent(struct device *dev, size_t size, void *vaddr,
84 dma_addr_t dma_addr) 85 dma_addr_t dma_addr, struct dma_attrs *attrs)
85{ 86{
86 gen_pool_free(coherent_pool, (unsigned long) vaddr, size); 87 gen_pool_free(coherent_pool, (unsigned long) vaddr, size);
87} 88}
@@ -202,8 +203,8 @@ static void hexagon_sync_single_for_device(struct device *dev,
202} 203}
203 204
204struct dma_map_ops hexagon_dma_ops = { 205struct dma_map_ops hexagon_dma_ops = {
205 .alloc_coherent = hexagon_dma_alloc_coherent, 206 .alloc = hexagon_dma_alloc_coherent,
206 .free_coherent = hexagon_free_coherent, 207 .free = hexagon_free_coherent,
207 .map_sg = hexagon_map_sg, 208 .map_sg = hexagon_map_sg,
208 .map_page = hexagon_map_page, 209 .map_page = hexagon_map_page,
209 .sync_single_for_cpu = hexagon_sync_single_for_cpu, 210 .sync_single_for_cpu = hexagon_sync_single_for_cpu,