MIPS: adapt for dma_map_ops changes
Adapt core MIPS architecture code for dma_map_ops changes: replace alloc/free_coherent with generic alloc/free methods. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> [added missing changes to arch/mips/cavium-octeon/dma-octeon.c, fixed attrs argument in dma-mapping.h] Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
committed by
Marek Szyprowski
parent
baa676fcf8
commit
e8d51e54ab
@@ -157,7 +157,7 @@ static void octeon_dma_sync_sg_for_device(struct device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *octeon_dma_alloc_coherent(struct device *dev, size_t size,
|
static void *octeon_dma_alloc_coherent(struct device *dev, size_t size,
|
||||||
dma_addr_t *dma_handle, gfp_t gfp)
|
dma_addr_t *dma_handle, gfp_t gfp, struct dma_attrs *attrs)
|
||||||
{
|
{
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ static void *octeon_dma_alloc_coherent(struct device *dev, size_t size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void octeon_dma_free_coherent(struct device *dev, size_t size,
|
static void octeon_dma_free_coherent(struct device *dev, size_t size,
|
||||||
void *vaddr, dma_addr_t dma_handle)
|
void *vaddr, dma_addr_t dma_handle, struct dma_attrs *attrs)
|
||||||
{
|
{
|
||||||
int order = get_order(size);
|
int order = get_order(size);
|
||||||
|
|
||||||
@@ -240,8 +240,8 @@ EXPORT_SYMBOL(dma_to_phys);
|
|||||||
|
|
||||||
static struct octeon_dma_map_ops octeon_linear_dma_map_ops = {
|
static struct octeon_dma_map_ops octeon_linear_dma_map_ops = {
|
||||||
.dma_map_ops = {
|
.dma_map_ops = {
|
||||||
.alloc_coherent = octeon_dma_alloc_coherent,
|
.alloc = octeon_dma_alloc_coherent,
|
||||||
.free_coherent = octeon_dma_free_coherent,
|
.free = octeon_dma_free_coherent,
|
||||||
.map_page = octeon_dma_map_page,
|
.map_page = octeon_dma_map_page,
|
||||||
.unmap_page = swiotlb_unmap_page,
|
.unmap_page = swiotlb_unmap_page,
|
||||||
.map_sg = octeon_dma_map_sg,
|
.map_sg = octeon_dma_map_sg,
|
||||||
@@ -325,8 +325,8 @@ void __init plat_swiotlb_setup(void)
|
|||||||
#ifdef CONFIG_PCI
|
#ifdef CONFIG_PCI
|
||||||
static struct octeon_dma_map_ops _octeon_pci_dma_map_ops = {
|
static struct octeon_dma_map_ops _octeon_pci_dma_map_ops = {
|
||||||
.dma_map_ops = {
|
.dma_map_ops = {
|
||||||
.alloc_coherent = octeon_dma_alloc_coherent,
|
.alloc = octeon_dma_alloc_coherent,
|
||||||
.free_coherent = octeon_dma_free_coherent,
|
.free = octeon_dma_free_coherent,
|
||||||
.map_page = octeon_dma_map_page,
|
.map_page = octeon_dma_map_page,
|
||||||
.unmap_page = swiotlb_unmap_page,
|
.unmap_page = swiotlb_unmap_page,
|
||||||
.map_sg = octeon_dma_map_sg,
|
.map_sg = octeon_dma_map_sg,
|
||||||
|
@@ -57,25 +57,31 @@ dma_set_mask(struct device *dev, u64 mask)
|
|||||||
extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
|
extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
|
||||||
enum dma_data_direction direction);
|
enum dma_data_direction direction);
|
||||||
|
|
||||||
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 gfp)
|
|
||||||
|
static inline void *dma_alloc_attrs(struct device *dev, size_t size,
|
||||||
|
dma_addr_t *dma_handle, gfp_t gfp,
|
||||||
|
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);
|
||||||
|
|
||||||
ret = ops->alloc_coherent(dev, size, dma_handle, gfp);
|
ret = ops->alloc(dev, size, dma_handle, gfp, 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 *vaddr, dma_addr_t dma_handle)
|
|
||||||
|
static inline void dma_free_attrs(struct device *dev, size_t size,
|
||||||
|
void *vaddr, dma_addr_t dma_handle,
|
||||||
|
struct dma_attrs *attrs)
|
||||||
{
|
{
|
||||||
struct dma_map_ops *ops = get_dma_ops(dev);
|
struct dma_map_ops *ops = get_dma_ops(dev);
|
||||||
|
|
||||||
ops->free_coherent(dev, size, vaddr, dma_handle);
|
ops->free(dev, size, vaddr, dma_handle, attrs);
|
||||||
|
|
||||||
debug_dma_free_coherent(dev, size, vaddr, dma_handle);
|
debug_dma_free_coherent(dev, size, vaddr, dma_handle);
|
||||||
}
|
}
|
||||||
|
@@ -98,7 +98,7 @@ void *dma_alloc_noncoherent(struct device *dev, size_t size,
|
|||||||
EXPORT_SYMBOL(dma_alloc_noncoherent);
|
EXPORT_SYMBOL(dma_alloc_noncoherent);
|
||||||
|
|
||||||
static void *mips_dma_alloc_coherent(struct device *dev, size_t size,
|
static void *mips_dma_alloc_coherent(struct device *dev, size_t size,
|
||||||
dma_addr_t * dma_handle, gfp_t gfp)
|
dma_addr_t * dma_handle, gfp_t gfp, struct dma_attrs *attrs)
|
||||||
{
|
{
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ void dma_free_noncoherent(struct device *dev, size_t size, void *vaddr,
|
|||||||
EXPORT_SYMBOL(dma_free_noncoherent);
|
EXPORT_SYMBOL(dma_free_noncoherent);
|
||||||
|
|
||||||
static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
|
static void mips_dma_free_coherent(struct device *dev, size_t size, void *vaddr,
|
||||||
dma_addr_t dma_handle)
|
dma_addr_t dma_handle, struct dma_attrs *attrs)
|
||||||
{
|
{
|
||||||
unsigned long addr = (unsigned long) vaddr;
|
unsigned long addr = (unsigned long) vaddr;
|
||||||
int order = get_order(size);
|
int order = get_order(size);
|
||||||
@@ -323,8 +323,8 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
|
|||||||
EXPORT_SYMBOL(dma_cache_sync);
|
EXPORT_SYMBOL(dma_cache_sync);
|
||||||
|
|
||||||
static struct dma_map_ops mips_default_dma_map_ops = {
|
static struct dma_map_ops mips_default_dma_map_ops = {
|
||||||
.alloc_coherent = mips_dma_alloc_coherent,
|
.alloc = mips_dma_alloc_coherent,
|
||||||
.free_coherent = mips_dma_free_coherent,
|
.free = mips_dma_free_coherent,
|
||||||
.map_page = mips_dma_map_page,
|
.map_page = mips_dma_map_page,
|
||||||
.unmap_page = mips_dma_unmap_page,
|
.unmap_page = mips_dma_unmap_page,
|
||||||
.map_sg = mips_dma_map_sg,
|
.map_sg = mips_dma_map_sg,
|
||||||
|
Reference in New Issue
Block a user