diff options
author | Bart Van Assche <bart.vanassche@sandisk.com> | 2017-01-20 16:04:04 -0500 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-01-24 12:23:35 -0500 |
commit | 815dd18788fe0d41899f51b91d0560279cf16b0d (patch) | |
tree | 11d20f38f588ee9b18f3c655e2972c01430ba47c /arch | |
parent | ca6e8e1031419549f67291ca31b43126f07cecdb (diff) |
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>
Diffstat (limited to 'arch')
30 files changed, 41 insertions, 64 deletions
diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h index d3480562411d..5d53666935e6 100644 --- a/arch/alpha/include/asm/dma-mapping.h +++ b/arch/alpha/include/asm/dma-mapping.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | extern const struct dma_map_ops *dma_ops; | 4 | extern const struct dma_map_ops *dma_ops; |
5 | 5 | ||
6 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 6 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
7 | { | 7 | { |
8 | return dma_ops; | 8 | return dma_ops; |
9 | } | 9 | } |
diff --git a/arch/arc/include/asm/dma-mapping.h b/arch/arc/include/asm/dma-mapping.h index fdff3aa60052..94285031c4fb 100644 --- a/arch/arc/include/asm/dma-mapping.h +++ b/arch/arc/include/asm/dma-mapping.h | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | extern const struct dma_map_ops arc_dma_ops; | 21 | extern const struct dma_map_ops arc_dma_ops; |
22 | 22 | ||
23 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 23 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
24 | { | 24 | { |
25 | return &arc_dma_ops; | 25 | return &arc_dma_ops; |
26 | } | 26 | } |
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index c7432d647e53..716656925975 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h | |||
@@ -23,12 +23,12 @@ static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev) | |||
23 | return &arm_dma_ops; | 23 | return &arm_dma_ops; |
24 | } | 24 | } |
25 | 25 | ||
26 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 26 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
27 | { | 27 | { |
28 | if (xen_initial_domain()) | 28 | if (xen_initial_domain()) |
29 | return xen_dma_ops; | 29 | return xen_dma_ops; |
30 | else | 30 | else |
31 | return __generic_dma_ops(dev); | 31 | return __generic_dma_ops(NULL); |
32 | } | 32 | } |
33 | 33 | ||
34 | #define HAVE_ARCH_DMA_SUPPORTED 1 | 34 | #define HAVE_ARCH_DMA_SUPPORTED 1 |
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index 58ae36cc3b60..505756cdc67a 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h | |||
@@ -39,12 +39,12 @@ static inline const struct dma_map_ops *__generic_dma_ops(struct device *dev) | |||
39 | return &dummy_dma_ops; | 39 | return &dummy_dma_ops; |
40 | } | 40 | } |
41 | 41 | ||
42 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 42 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
43 | { | 43 | { |
44 | if (xen_initial_domain()) | 44 | if (xen_initial_domain()) |
45 | return xen_dma_ops; | 45 | return xen_dma_ops; |
46 | else | 46 | else |
47 | return __generic_dma_ops(dev); | 47 | return __generic_dma_ops(NULL); |
48 | } | 48 | } |
49 | 49 | ||
50 | void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, | 50 | void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, |
diff --git a/arch/avr32/include/asm/dma-mapping.h b/arch/avr32/include/asm/dma-mapping.h index b2b43c0e0774..7388451f9905 100644 --- a/arch/avr32/include/asm/dma-mapping.h +++ b/arch/avr32/include/asm/dma-mapping.h | |||
@@ -6,7 +6,7 @@ extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | |||
6 | 6 | ||
7 | extern const struct dma_map_ops avr32_dma_ops; | 7 | extern const struct dma_map_ops avr32_dma_ops; |
8 | 8 | ||
9 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 9 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
10 | { | 10 | { |
11 | return &avr32_dma_ops; | 11 | return &avr32_dma_ops; |
12 | } | 12 | } |
diff --git a/arch/blackfin/include/asm/dma-mapping.h b/arch/blackfin/include/asm/dma-mapping.h index 320fb50fbd41..04254ac36bed 100644 --- a/arch/blackfin/include/asm/dma-mapping.h +++ b/arch/blackfin/include/asm/dma-mapping.h | |||
@@ -38,7 +38,7 @@ _dma_sync(dma_addr_t addr, size_t size, enum dma_data_direction dir) | |||
38 | 38 | ||
39 | extern const struct dma_map_ops bfin_dma_ops; | 39 | extern const struct dma_map_ops bfin_dma_ops; |
40 | 40 | ||
41 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 41 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
42 | { | 42 | { |
43 | return &bfin_dma_ops; | 43 | return &bfin_dma_ops; |
44 | } | 44 | } |
diff --git a/arch/c6x/include/asm/dma-mapping.h b/arch/c6x/include/asm/dma-mapping.h index 88258b9ebc8e..aca9f755e4f8 100644 --- a/arch/c6x/include/asm/dma-mapping.h +++ b/arch/c6x/include/asm/dma-mapping.h | |||
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | extern const struct dma_map_ops c6x_dma_ops; | 20 | extern const struct dma_map_ops c6x_dma_ops; |
21 | 21 | ||
22 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 22 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
23 | { | 23 | { |
24 | return &c6x_dma_ops; | 24 | return &c6x_dma_ops; |
25 | } | 25 | } |
diff --git a/arch/cris/include/asm/dma-mapping.h b/arch/cris/include/asm/dma-mapping.h index aae4fbc0a656..256169de3743 100644 --- a/arch/cris/include/asm/dma-mapping.h +++ b/arch/cris/include/asm/dma-mapping.h | |||
@@ -4,12 +4,12 @@ | |||
4 | #ifdef CONFIG_PCI | 4 | #ifdef CONFIG_PCI |
5 | extern const struct dma_map_ops v32_dma_ops; | 5 | extern const struct dma_map_ops v32_dma_ops; |
6 | 6 | ||
7 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 7 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
8 | { | 8 | { |
9 | return &v32_dma_ops; | 9 | return &v32_dma_ops; |
10 | } | 10 | } |
11 | #else | 11 | #else |
12 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 12 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
13 | { | 13 | { |
14 | BUG(); | 14 | BUG(); |
15 | return NULL; | 15 | return NULL; |
diff --git a/arch/frv/include/asm/dma-mapping.h b/arch/frv/include/asm/dma-mapping.h index 150cc00544a8..354900917585 100644 --- a/arch/frv/include/asm/dma-mapping.h +++ b/arch/frv/include/asm/dma-mapping.h | |||
@@ -9,7 +9,7 @@ extern unsigned long __nongprelbss dma_coherent_mem_end; | |||
9 | 9 | ||
10 | extern const struct dma_map_ops frv_dma_ops; | 10 | extern const struct dma_map_ops frv_dma_ops; |
11 | 11 | ||
12 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 12 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
13 | { | 13 | { |
14 | return &frv_dma_ops; | 14 | return &frv_dma_ops; |
15 | } | 15 | } |
diff --git a/arch/h8300/include/asm/dma-mapping.h b/arch/h8300/include/asm/dma-mapping.h index f804bca4c13f..847c7562e046 100644 --- a/arch/h8300/include/asm/dma-mapping.h +++ b/arch/h8300/include/asm/dma-mapping.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | extern const struct dma_map_ops h8300_dma_map_ops; | 4 | extern const struct dma_map_ops h8300_dma_map_ops; |
5 | 5 | ||
6 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 6 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
7 | { | 7 | { |
8 | return &h8300_dma_map_ops; | 8 | return &h8300_dma_map_ops; |
9 | } | 9 | } |
diff --git a/arch/hexagon/include/asm/dma-mapping.h b/arch/hexagon/include/asm/dma-mapping.h index b812e917cd95..d3a87bd9b686 100644 --- a/arch/hexagon/include/asm/dma-mapping.h +++ b/arch/hexagon/include/asm/dma-mapping.h | |||
@@ -34,11 +34,8 @@ extern int bad_dma_address; | |||
34 | 34 | ||
35 | extern const struct dma_map_ops *dma_ops; | 35 | extern const struct dma_map_ops *dma_ops; |
36 | 36 | ||
37 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 37 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
38 | { | 38 | { |
39 | if (unlikely(dev == NULL)) | ||
40 | return NULL; | ||
41 | |||
42 | return dma_ops; | 39 | return dma_ops; |
43 | } | 40 | } |
44 | 41 | ||
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h index 05e467d56d86..73ec3c6f4cfe 100644 --- a/arch/ia64/include/asm/dma-mapping.h +++ b/arch/ia64/include/asm/dma-mapping.h | |||
@@ -23,7 +23,10 @@ extern void machvec_dma_sync_single(struct device *, dma_addr_t, size_t, | |||
23 | extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int, | 23 | extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int, |
24 | enum dma_data_direction); | 24 | enum dma_data_direction); |
25 | 25 | ||
26 | #define get_dma_ops(dev) platform_dma_get_ops(dev) | 26 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
27 | { | ||
28 | return platform_dma_get_ops(NULL); | ||
29 | } | ||
27 | 30 | ||
28 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | 31 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) |
29 | { | 32 | { |
diff --git a/arch/m32r/include/asm/dma-mapping.h b/arch/m32r/include/asm/dma-mapping.h index 27b1597ac563..c01d9f52d228 100644 --- a/arch/m32r/include/asm/dma-mapping.h +++ b/arch/m32r/include/asm/dma-mapping.h | |||
@@ -10,10 +10,8 @@ | |||
10 | 10 | ||
11 | #define DMA_ERROR_CODE (~(dma_addr_t)0x0) | 11 | #define DMA_ERROR_CODE (~(dma_addr_t)0x0) |
12 | 12 | ||
13 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 13 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
14 | { | 14 | { |
15 | if (dev && dev->dma_ops) | ||
16 | return dev->dma_ops; | ||
17 | return &dma_noop_ops; | 15 | return &dma_noop_ops; |
18 | } | 16 | } |
19 | 17 | ||
diff --git a/arch/m68k/include/asm/dma-mapping.h b/arch/m68k/include/asm/dma-mapping.h index 863509939d5a..9210e470771b 100644 --- a/arch/m68k/include/asm/dma-mapping.h +++ b/arch/m68k/include/asm/dma-mapping.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | extern const struct dma_map_ops m68k_dma_ops; | 4 | extern const struct dma_map_ops m68k_dma_ops; |
5 | 5 | ||
6 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 6 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
7 | { | 7 | { |
8 | return &m68k_dma_ops; | 8 | return &m68k_dma_ops; |
9 | } | 9 | } |
diff --git a/arch/metag/include/asm/dma-mapping.h b/arch/metag/include/asm/dma-mapping.h index c156a7ac732f..fad3dc3cb210 100644 --- a/arch/metag/include/asm/dma-mapping.h +++ b/arch/metag/include/asm/dma-mapping.h | |||
@@ -3,7 +3,7 @@ | |||
3 | 3 | ||
4 | extern const struct dma_map_ops metag_dma_ops; | 4 | extern const struct dma_map_ops metag_dma_ops; |
5 | 5 | ||
6 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 6 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
7 | { | 7 | { |
8 | return &metag_dma_ops; | 8 | return &metag_dma_ops; |
9 | } | 9 | } |
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h index c7faf2fb51d6..3fad5e722a66 100644 --- a/arch/microblaze/include/asm/dma-mapping.h +++ b/arch/microblaze/include/asm/dma-mapping.h | |||
@@ -38,7 +38,7 @@ | |||
38 | */ | 38 | */ |
39 | extern const struct dma_map_ops dma_direct_ops; | 39 | extern const struct dma_map_ops dma_direct_ops; |
40 | 40 | ||
41 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 41 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
42 | { | 42 | { |
43 | return &dma_direct_ops; | 43 | return &dma_direct_ops; |
44 | } | 44 | } |
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h index dad3b09fe993..aba71385f9d1 100644 --- a/arch/mips/include/asm/dma-mapping.h +++ b/arch/mips/include/asm/dma-mapping.h | |||
@@ -11,12 +11,9 @@ | |||
11 | 11 | ||
12 | extern const struct dma_map_ops *mips_dma_map_ops; | 12 | extern const struct dma_map_ops *mips_dma_map_ops; |
13 | 13 | ||
14 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 14 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
15 | { | 15 | { |
16 | if (dev && dev->dma_ops) | 16 | return mips_dma_map_ops; |
17 | return dev->dma_ops; | ||
18 | else | ||
19 | return mips_dma_map_ops; | ||
20 | } | 17 | } |
21 | 18 | ||
22 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | 19 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) |
diff --git a/arch/mn10300/include/asm/dma-mapping.h b/arch/mn10300/include/asm/dma-mapping.h index 564e3927e005..737ef574b3ea 100644 --- a/arch/mn10300/include/asm/dma-mapping.h +++ b/arch/mn10300/include/asm/dma-mapping.h | |||
@@ -16,7 +16,7 @@ | |||
16 | 16 | ||
17 | extern const struct dma_map_ops mn10300_dma_ops; | 17 | extern const struct dma_map_ops mn10300_dma_ops; |
18 | 18 | ||
19 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 19 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
20 | { | 20 | { |
21 | return &mn10300_dma_ops; | 21 | return &mn10300_dma_ops; |
22 | } | 22 | } |
diff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h index aa00d839a64b..7b3c6f280293 100644 --- a/arch/nios2/include/asm/dma-mapping.h +++ b/arch/nios2/include/asm/dma-mapping.h | |||
@@ -12,7 +12,7 @@ | |||
12 | 12 | ||
13 | extern const struct dma_map_ops nios2_dma_ops; | 13 | extern const struct dma_map_ops nios2_dma_ops; |
14 | 14 | ||
15 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 15 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
16 | { | 16 | { |
17 | return &nios2_dma_ops; | 17 | return &nios2_dma_ops; |
18 | } | 18 | } |
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h index 88acbedb4947..0c0075f17145 100644 --- a/arch/openrisc/include/asm/dma-mapping.h +++ b/arch/openrisc/include/asm/dma-mapping.h | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | extern const struct dma_map_ops or1k_dma_map_ops; | 31 | extern const struct dma_map_ops or1k_dma_map_ops; |
32 | 32 | ||
33 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 33 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
34 | { | 34 | { |
35 | return &or1k_dma_map_ops; | 35 | return &or1k_dma_map_ops; |
36 | } | 36 | } |
diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h index 1749073e44fc..5404c6a726b2 100644 --- a/arch/parisc/include/asm/dma-mapping.h +++ b/arch/parisc/include/asm/dma-mapping.h | |||
@@ -27,7 +27,7 @@ extern const struct dma_map_ops pcx_dma_ops; | |||
27 | 27 | ||
28 | extern const struct dma_map_ops *hppa_dma_ops; | 28 | extern const struct dma_map_ops *hppa_dma_ops; |
29 | 29 | ||
30 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 30 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
31 | { | 31 | { |
32 | return hppa_dma_ops; | 32 | return hppa_dma_ops; |
33 | } | 33 | } |
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 8275603ba4d5..181a095468e4 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h | |||
@@ -78,17 +78,14 @@ extern struct dma_map_ops dma_iommu_ops; | |||
78 | #endif | 78 | #endif |
79 | extern const struct dma_map_ops dma_direct_ops; | 79 | extern const struct dma_map_ops dma_direct_ops; |
80 | 80 | ||
81 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 81 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
82 | { | 82 | { |
83 | /* We don't handle the NULL dev case for ISA for now. We could | 83 | /* We don't handle the NULL dev case for ISA for now. We could |
84 | * do it via an out of line call but it is not needed for now. The | 84 | * do it via an out of line call but it is not needed for now. The |
85 | * only ISA DMA device we support is the floppy and we have a hack | 85 | * only ISA DMA device we support is the floppy and we have a hack |
86 | * in the floppy driver directly to get a device for us. | 86 | * in the floppy driver directly to get a device for us. |
87 | */ | 87 | */ |
88 | if (unlikely(dev == NULL)) | 88 | return NULL; |
89 | return NULL; | ||
90 | |||
91 | return dev->dma_ops; | ||
92 | } | 89 | } |
93 | 90 | ||
94 | /* | 91 | /* |
diff --git a/arch/powerpc/include/asm/ps3.h b/arch/powerpc/include/asm/ps3.h index a19f831a4cc9..17ee719e799f 100644 --- a/arch/powerpc/include/asm/ps3.h +++ b/arch/powerpc/include/asm/ps3.h | |||
@@ -435,7 +435,7 @@ static inline void *ps3_system_bus_get_drvdata( | |||
435 | return dev_get_drvdata(&dev->core); | 435 | return dev_get_drvdata(&dev->core); |
436 | } | 436 | } |
437 | 437 | ||
438 | /* These two need global scope for get_dma_ops(). */ | 438 | /* These two need global scope for get_arch_dma_ops(). */ |
439 | 439 | ||
440 | extern struct bus_type ps3_system_bus_type; | 440 | extern struct bus_type ps3_system_bus_type; |
441 | 441 | ||
diff --git a/arch/s390/include/asm/dma-mapping.h b/arch/s390/include/asm/dma-mapping.h index a872027d0c1b..3108b8dbe266 100644 --- a/arch/s390/include/asm/dma-mapping.h +++ b/arch/s390/include/asm/dma-mapping.h | |||
@@ -12,10 +12,8 @@ | |||
12 | 12 | ||
13 | extern const struct dma_map_ops s390_pci_dma_ops; | 13 | extern const struct dma_map_ops s390_pci_dma_ops; |
14 | 14 | ||
15 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 15 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
16 | { | 16 | { |
17 | if (dev && dev->dma_ops) | ||
18 | return dev->dma_ops; | ||
19 | return &dma_noop_ops; | 17 | return &dma_noop_ops; |
20 | } | 18 | } |
21 | 19 | ||
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h index a7382c34c241..d99008af5f73 100644 --- a/arch/sh/include/asm/dma-mapping.h +++ b/arch/sh/include/asm/dma-mapping.h | |||
@@ -4,7 +4,7 @@ | |||
4 | extern const struct dma_map_ops *dma_ops; | 4 | extern const struct dma_map_ops *dma_ops; |
5 | extern void no_iommu_init(void); | 5 | extern void no_iommu_init(void); |
6 | 6 | ||
7 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 7 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
8 | { | 8 | { |
9 | return dma_ops; | 9 | return dma_ops; |
10 | } | 10 | } |
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h index 3d2babc0c4c6..69cc627779f2 100644 --- a/arch/sparc/include/asm/dma-mapping.h +++ b/arch/sparc/include/asm/dma-mapping.h | |||
@@ -24,14 +24,14 @@ extern const struct dma_map_ops pci32_dma_ops; | |||
24 | 24 | ||
25 | extern struct bus_type pci_bus_type; | 25 | extern struct bus_type pci_bus_type; |
26 | 26 | ||
27 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 27 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
28 | { | 28 | { |
29 | #ifdef CONFIG_SPARC_LEON | 29 | #ifdef CONFIG_SPARC_LEON |
30 | if (sparc_cpu_model == sparc_leon) | 30 | if (sparc_cpu_model == sparc_leon) |
31 | return leon_dma_ops; | 31 | return leon_dma_ops; |
32 | #endif | 32 | #endif |
33 | #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI) | 33 | #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI) |
34 | if (dev->bus == &pci_bus_type) | 34 | if (bus == &pci_bus_type) |
35 | return &pci32_dma_ops; | 35 | return &pci32_dma_ops; |
36 | #endif | 36 | #endif |
37 | return dma_ops; | 37 | return dma_ops; |
diff --git a/arch/tile/include/asm/dma-mapping.h b/arch/tile/include/asm/dma-mapping.h index 2562995a6ac9..bbc71a29b2c6 100644 --- a/arch/tile/include/asm/dma-mapping.h +++ b/arch/tile/include/asm/dma-mapping.h | |||
@@ -29,12 +29,9 @@ extern const struct dma_map_ops *gx_pci_dma_map_ops; | |||
29 | extern const struct dma_map_ops *gx_legacy_pci_dma_map_ops; | 29 | extern const struct dma_map_ops *gx_legacy_pci_dma_map_ops; |
30 | extern const struct dma_map_ops *gx_hybrid_pci_dma_map_ops; | 30 | extern const struct dma_map_ops *gx_hybrid_pci_dma_map_ops; |
31 | 31 | ||
32 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 32 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
33 | { | 33 | { |
34 | if (dev && dev->dma_ops) | 34 | return tile_dma_map_ops; |
35 | return dev->dma_ops; | ||
36 | else | ||
37 | return tile_dma_map_ops; | ||
38 | } | 35 | } |
39 | 36 | ||
40 | static inline dma_addr_t get_dma_offset(struct device *dev) | 37 | static inline dma_addr_t get_dma_offset(struct device *dev) |
diff --git a/arch/unicore32/include/asm/dma-mapping.h b/arch/unicore32/include/asm/dma-mapping.h index 14d7729c7b73..518ba5848dd6 100644 --- a/arch/unicore32/include/asm/dma-mapping.h +++ b/arch/unicore32/include/asm/dma-mapping.h | |||
@@ -23,7 +23,7 @@ | |||
23 | 23 | ||
24 | extern const struct dma_map_ops swiotlb_dma_map_ops; | 24 | extern const struct dma_map_ops swiotlb_dma_map_ops; |
25 | 25 | ||
26 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 26 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
27 | { | 27 | { |
28 | return &swiotlb_dma_map_ops; | 28 | return &swiotlb_dma_map_ops; |
29 | } | 29 | } |
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h index 94b5b96966cb..08a0838b83fb 100644 --- a/arch/x86/include/asm/dma-mapping.h +++ b/arch/x86/include/asm/dma-mapping.h | |||
@@ -27,16 +27,9 @@ extern int panic_on_overflow; | |||
27 | 27 | ||
28 | extern const struct dma_map_ops *dma_ops; | 28 | extern const struct dma_map_ops *dma_ops; |
29 | 29 | ||
30 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 30 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
31 | { | 31 | { |
32 | #ifndef CONFIG_X86_DEV_DMA_OPS | ||
33 | return dma_ops; | 32 | return dma_ops; |
34 | #else | ||
35 | if (unlikely(!dev) || !dev->dma_ops) | ||
36 | return dma_ops; | ||
37 | else | ||
38 | return dev->dma_ops; | ||
39 | #endif | ||
40 | } | 33 | } |
41 | 34 | ||
42 | bool arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp); | 35 | bool arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp); |
diff --git a/arch/xtensa/include/asm/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h index 9eecfc3c5dc4..c6140fa8c0be 100644 --- a/arch/xtensa/include/asm/dma-mapping.h +++ b/arch/xtensa/include/asm/dma-mapping.h | |||
@@ -20,12 +20,9 @@ | |||
20 | 20 | ||
21 | extern const struct dma_map_ops xtensa_dma_map_ops; | 21 | extern const struct dma_map_ops xtensa_dma_map_ops; |
22 | 22 | ||
23 | static inline const struct dma_map_ops *get_dma_ops(struct device *dev) | 23 | static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus) |
24 | { | 24 | { |
25 | if (dev && dev->dma_ops) | 25 | return &xtensa_dma_map_ops; |
26 | return dev->dma_ops; | ||
27 | else | ||
28 | return &xtensa_dma_map_ops; | ||
29 | } | 26 | } |
30 | 27 | ||
31 | void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | 28 | void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |