Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77345520 authored by Marek Szyprowski's avatar Marek Szyprowski
Browse files

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: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Acked-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarRichard Kuo <rkuo@codeaurora.org>
parent ffc4a3fa
Loading
Loading
Loading
Loading
+12 −6
Original line number Original line Diff line number Diff line
@@ -71,29 +71,35 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
	return (dma_addr == bad_dma_address);
	return (dma_addr == bad_dma_address);
}
}


static inline void *dma_alloc_coherent(struct device *dev, size_t size,
#define dma_alloc_coherent(d,s,h,f)	dma_alloc_attrs(d,s,h,f,NULL)
				       dma_addr_t *dma_handle, gfp_t flag)

static inline void *dma_alloc_attrs(struct device *dev, size_t size,
				    dma_addr_t *dma_handle, gfp_t flag,
				    struct dma_attrs *attrs)
{
{
	void *ret;
	void *ret;
	struct dma_map_ops *ops = get_dma_ops(dev);
	struct dma_map_ops *ops = get_dma_ops(dev);


	BUG_ON(!dma_ops);
	BUG_ON(!dma_ops);


	ret = ops->alloc_coherent(dev, size, dma_handle, flag);
	ret = ops->alloc(dev, size, dma_handle, flag, attrs);


	debug_dma_alloc_coherent(dev, size, *dma_handle, ret);
	debug_dma_alloc_coherent(dev, size, *dma_handle, ret);


	return ret;
	return ret;
}
}


static inline void dma_free_coherent(struct device *dev, size_t size,
#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL)
				     void *cpu_addr, dma_addr_t dma_handle)

static inline void dma_free_attrs(struct device *dev, size_t size,
				  void *cpu_addr, dma_addr_t dma_handle,
				  struct dma_attrs *attrs)
{
{
	struct dma_map_ops *dma_ops = get_dma_ops(dev);
	struct dma_map_ops *dma_ops = get_dma_ops(dev);


	BUG_ON(!dma_ops);
	BUG_ON(!dma_ops);


	dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
	dma_ops->free(dev, size, cpu_addr, dma_handle, attrs);


	debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
	debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
}
}
+5 −4
Original line number Original line Diff line number Diff line
@@ -54,7 +54,8 @@ static struct gen_pool *coherent_pool;
/* Allocates from a pool of uncached memory that was reserved at boot time */
/* Allocates from a pool of uncached memory that was reserved at boot time */


void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
				 dma_addr_t *dma_addr, gfp_t flag)
				 dma_addr_t *dma_addr, gfp_t flag,
				 struct dma_attrs *attrs)
{
{
	void *ret;
	void *ret;


@@ -81,7 +82,7 @@ void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
}
}


static void hexagon_free_coherent(struct device *dev, size_t size, void *vaddr,
static void hexagon_free_coherent(struct device *dev, size_t size, void *vaddr,
				  dma_addr_t dma_addr)
				  dma_addr_t dma_addr, struct dma_attrs *attrs)
{
{
	gen_pool_free(coherent_pool, (unsigned long) vaddr, size);
	gen_pool_free(coherent_pool, (unsigned long) vaddr, size);
}
}
@@ -202,8 +203,8 @@ static void hexagon_sync_single_for_device(struct device *dev,
}
}


struct dma_map_ops hexagon_dma_ops = {
struct dma_map_ops hexagon_dma_ops = {
	.alloc_coherent	= hexagon_dma_alloc_coherent,
	.alloc		= hexagon_dma_alloc_coherent,
	.free_coherent	= hexagon_free_coherent,
	.free		= hexagon_free_coherent,
	.map_sg		= hexagon_map_sg,
	.map_sg		= hexagon_map_sg,
	.map_page	= hexagon_map_page,
	.map_page	= hexagon_map_page,
	.sync_single_for_cpu = hexagon_sync_single_for_cpu,
	.sync_single_for_cpu = hexagon_sync_single_for_cpu,