treewide: Consolidate get_dma_ops() implementations

Introduce a new architecture-specific get_arch_dma_ops() function
that takes a struct bus_type * argument. Add get_dma_ops() in
<linux/dma-mapping.h>.

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Juergen Gross <jgross@suse.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: linux-arch@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Russell King <linux@armlinux.org.uk>
Cc: x86@kernel.org
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
Bart Van Assche
2017-01-20 13:04:04 -08:00
committed by Doug Ledford
parent ca6e8e1031
commit 815dd18788
31 changed files with 48 additions and 64 deletions

View File

@@ -3,7 +3,7 @@
extern const struct dma_map_ops *dma_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return dma_ops;
}

View File

@@ -20,7 +20,7 @@
extern const struct dma_map_ops arc_dma_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return &arc_dma_ops;
}

View File

@@ -23,12 +23,12 @@ static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
return &arm_dma_ops;
}
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
if (xen_initial_domain())
return xen_dma_ops;
else
return __generic_dma_ops(dev);
return __generic_dma_ops(NULL);
}
#define HAVE_ARCH_DMA_SUPPORTED 1

View File

@@ -39,12 +39,12 @@ static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev)
return &dummy_dma_ops;
}
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
if (xen_initial_domain())
return xen_dma_ops;
else
return __generic_dma_ops(dev);
return __generic_dma_ops(NULL);
}
void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,

View File

@@ -6,7 +6,7 @@ extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
extern const struct dma_map_ops avr32_dma_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return &avr32_dma_ops;
}

View File

@@ -38,7 +38,7 @@ _dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir)
extern const struct dma_map_ops bfin_dma_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return &bfin_dma_ops;
}

View File

@@ -19,7 +19,7 @@
extern const struct dma_map_ops c6x_dma_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return &c6x_dma_ops;
}

View File

@@ -4,12 +4,12 @@
#ifdef CONFIG_PCI
extern const struct dma_map_ops v32_dma_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return &v32_dma_ops;
}
#else
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
BUG();
return NULL;

View File

@@ -9,7 +9,7 @@ extern unsigned long __nongprelbss dma_coherent_mem_end;
extern const struct dma_map_ops frv_dma_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return &frv_dma_ops;
}

View File

@@ -3,7 +3,7 @@
extern const struct dma_map_ops h8300_dma_map_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return &h8300_dma_map_ops;
}

View File

@@ -34,11 +34,8 @@ extern int bad_dma_address;
extern const struct dma_map_ops *dma_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
if (unlikely(dev == NULL))
return NULL;
return dma_ops;
}

View File

@@ -23,7 +23,10 @@ extern void machvec_dma_sync_single(struct device *, dma_addr_t, size_t,
extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int,
enum dma_data_direction);
#define get_dma_ops(dev) platform_dma_get_ops(dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return platform_dma_get_ops(NULL);
}
static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
{

View File

@@ -10,10 +10,8 @@
#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
if (dev && dev->dma_ops)
return dev->dma_ops;
return &dma_noop_ops;
}

View File

@@ -3,7 +3,7 @@
extern const struct dma_map_ops m68k_dma_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return &m68k_dma_ops;
}

View File

@@ -3,7 +3,7 @@
extern const struct dma_map_ops metag_dma_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return &metag_dma_ops;
}

View File

@@ -38,7 +38,7 @@
*/
extern const struct dma_map_ops dma_direct_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return &dma_direct_ops;
}

View File

@@ -11,12 +11,9 @@
extern const struct dma_map_ops *mips_dma_map_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
if (dev && dev->dma_ops)
return dev->dma_ops;
else
return mips_dma_map_ops;
return mips_dma_map_ops;
}
static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)

View File

@@ -16,7 +16,7 @@
extern const struct dma_map_ops mn10300_dma_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return &mn10300_dma_ops;
}

View File

@@ -12,7 +12,7 @@
extern const struct dma_map_ops nios2_dma_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return &nios2_dma_ops;
}

View File

@@ -30,7 +30,7 @@
extern const struct dma_map_ops or1k_dma_map_ops;
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
{
return &or1k_dma_map_ops;
}

Some files were not shown because too many files have changed in this diff Show More