diff options
author | Christoph Hellwig <hch@lst.de> | 2015-09-09 18:39:49 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-10 16:29:01 -0400 |
commit | ee196371d5cb1942ebdccc16bdce389812aa265e (patch) | |
tree | 59d8b00098bf929a6bb093c78e239cf265632922 | |
parent | efa21e432c7b3c8ae976039d614a017799b6e874 (diff) |
dma-mapping: consolidate dma_supported
Most architectures just call into ->dma_supported, but some also return 1
if the method is not present, or 0 if no dma ops are present (although
that should never happeb). Consolidate this more broad version into
common code.
Also fix h8300 which inorrectly always returned 0, which would have been
a problem if it's dma_set_mask implementation wasn't a similarly buggy
noop.
As a few architectures have much more elaborate implementations, we
still allow for arch overrides.
[jcmvbkbc@gmail.com: fix xtensa]
Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Michal Simek <monstr@monstr.eu>
Cc: Jonas Bonn <jonas@southpole.se>
Cc: Chris Metcalf <cmetcalf@ezchip.com>
Cc: Guan Xuetao <gxt@mprc.pku.edu.cn>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | arch/alpha/include/asm/dma-mapping.h | 5 | ||||
-rw-r--r-- | arch/arm/include/asm/dma-mapping.h | 6 | ||||
-rw-r--r-- | arch/arm64/include/asm/dma-mapping.h | 6 | ||||
-rw-r--r-- | arch/h8300/include/asm/dma-mapping.h | 5 | ||||
-rw-r--r-- | arch/hexagon/include/asm/dma-mapping.h | 1 | ||||
-rw-r--r-- | arch/ia64/include/asm/dma-mapping.h | 6 | ||||
-rw-r--r-- | arch/microblaze/include/asm/dma-mapping.h | 13 | ||||
-rw-r--r-- | arch/mips/include/asm/dma-mapping.h | 6 | ||||
-rw-r--r-- | arch/openrisc/include/asm/dma-mapping.h | 5 | ||||
-rw-r--r-- | arch/powerpc/include/asm/dma-mapping.h | 11 | ||||
-rw-r--r-- | arch/s390/include/asm/dma-mapping.h | 9 | ||||
-rw-r--r-- | arch/sh/include/asm/dma-mapping.h | 10 | ||||
-rw-r--r-- | arch/sparc/include/asm/dma-mapping.h | 1 | ||||
-rw-r--r-- | arch/tile/include/asm/dma-mapping.h | 6 | ||||
-rw-r--r-- | arch/unicore32/include/asm/dma-mapping.h | 10 | ||||
-rw-r--r-- | arch/x86/include/asm/dma-mapping.h | 4 | ||||
-rw-r--r-- | arch/xtensa/include/asm/dma-mapping.h | 6 | ||||
-rw-r--r-- | include/asm-generic/dma-mapping-common.h | 13 |
18 files changed, 25 insertions, 98 deletions
diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h index 80ac3e835efe..9d763e535c5a 100644 --- a/arch/alpha/include/asm/dma-mapping.h +++ b/arch/alpha/include/asm/dma-mapping.h | |||
@@ -12,11 +12,6 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) | |||
12 | 12 | ||
13 | #include <asm-generic/dma-mapping-common.h> | 13 | #include <asm-generic/dma-mapping-common.h> |
14 | 14 | ||
15 | static inline int dma_supported(struct device *dev, u64 mask) | ||
16 | { | ||
17 | return get_dma_ops(dev)->dma_supported(dev, mask); | ||
18 | } | ||
19 | |||
20 | static inline int dma_set_mask(struct device *dev, u64 mask) | 15 | static inline int dma_set_mask(struct device *dev, u64 mask) |
21 | { | 16 | { |
22 | return get_dma_ops(dev)->set_dma_mask(dev, mask); | 17 | return get_dma_ops(dev)->set_dma_mask(dev, mask); |
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index 9bef3c541c39..2f9c731691c0 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h | |||
@@ -38,12 +38,14 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) | |||
38 | dev->archdata.dma_ops = ops; | 38 | dev->archdata.dma_ops = ops; |
39 | } | 39 | } |
40 | 40 | ||
41 | #define HAVE_ARCH_DMA_SUPPORTED 1 | ||
42 | extern int dma_supported(struct device *dev, u64 mask); | ||
43 | |||
41 | /* | 44 | /* |
42 | * Note that while the generic code provides dummy dma_{alloc,free}_noncoherent | 45 | * Note that while the generic code provides dummy dma_{alloc,free}_noncoherent |
43 | * implementations, we don't provide a dma_cache_sync function so drivers using | 46 | * implementations, we don't provide a dma_cache_sync function so drivers using |
44 | * this API are highlighted with build warnings. | 47 | * this API are highlighted with build warnings. |
45 | */ | 48 | */ |
46 | |||
47 | #include <asm-generic/dma-mapping-common.h> | 49 | #include <asm-generic/dma-mapping-common.h> |
48 | 50 | ||
49 | static inline int dma_set_mask(struct device *dev, u64 mask) | 51 | static inline int dma_set_mask(struct device *dev, u64 mask) |
@@ -172,8 +174,6 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | |||
172 | 174 | ||
173 | static inline void dma_mark_clean(void *addr, size_t size) { } | 175 | static inline void dma_mark_clean(void *addr, size_t size) { } |
174 | 176 | ||
175 | extern int dma_supported(struct device *dev, u64 mask); | ||
176 | |||
177 | extern int arm_dma_set_mask(struct device *dev, u64 dma_mask); | 177 | extern int arm_dma_set_mask(struct device *dev, u64 dma_mask); |
178 | 178 | ||
179 | /** | 179 | /** |
diff --git a/arch/arm64/include/asm/dma-mapping.h b/arch/arm64/include/asm/dma-mapping.h index f45f444b7a66..f519a58c55ae 100644 --- a/arch/arm64/include/asm/dma-mapping.h +++ b/arch/arm64/include/asm/dma-mapping.h | |||
@@ -84,12 +84,6 @@ static inline phys_addr_t dma_to_phys(struct device *dev, dma_addr_t dev_addr) | |||
84 | return (phys_addr_t)dev_addr; | 84 | return (phys_addr_t)dev_addr; |
85 | } | 85 | } |
86 | 86 | ||
87 | static inline int dma_supported(struct device *dev, u64 mask) | ||
88 | { | ||
89 | struct dma_map_ops *ops = get_dma_ops(dev); | ||
90 | return ops->dma_supported(dev, mask); | ||
91 | } | ||
92 | |||
93 | static inline int dma_set_mask(struct device *dev, u64 mask) | 87 | static inline int dma_set_mask(struct device *dev, u64 mask) |
94 | { | 88 | { |
95 | if (!dev->dma_mask || !dma_supported(dev, mask)) | 89 | if (!dev->dma_mask || !dma_supported(dev, mask)) |
diff --git a/arch/h8300/include/asm/dma-mapping.h b/arch/h8300/include/asm/dma-mapping.h index 5eef05382fff..48d652eb1b5f 100644 --- a/arch/h8300/include/asm/dma-mapping.h +++ b/arch/h8300/include/asm/dma-mapping.h | |||
@@ -10,11 +10,6 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) | |||
10 | 10 | ||
11 | #include <asm-generic/dma-mapping-common.h> | 11 | #include <asm-generic/dma-mapping-common.h> |
12 | 12 | ||
13 | static inline int dma_supported(struct device *dev, u64 mask) | ||
14 | { | ||
15 | return 0; | ||
16 | } | ||
17 | |||
18 | static inline int dma_set_mask(struct device *dev, u64 mask) | 13 | static inline int dma_set_mask(struct device *dev, u64 mask) |
19 | { | 14 | { |
20 | return 0; | 15 | return 0; |
diff --git a/arch/hexagon/include/asm/dma-mapping.h b/arch/hexagon/include/asm/dma-mapping.h index e66119290eca..36e8de710b32 100644 --- a/arch/hexagon/include/asm/dma-mapping.h +++ b/arch/hexagon/include/asm/dma-mapping.h | |||
@@ -43,6 +43,7 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) | |||
43 | return dma_ops; | 43 | return dma_ops; |
44 | } | 44 | } |
45 | 45 | ||
46 | #define HAVE_ARCH_DMA_SUPPORTED 1 | ||
46 | extern int dma_supported(struct device *dev, u64 mask); | 47 | extern int dma_supported(struct device *dev, u64 mask); |
47 | extern int dma_set_mask(struct device *dev, u64 mask); | 48 | extern int dma_set_mask(struct device *dev, u64 mask); |
48 | extern int dma_is_consistent(struct device *dev, dma_addr_t dma_handle); | 49 | extern int dma_is_consistent(struct device *dev, dma_addr_t dma_handle); |
diff --git a/arch/ia64/include/asm/dma-mapping.h b/arch/ia64/include/asm/dma-mapping.h index 27b713d0edbc..7982caa7c5e7 100644 --- a/arch/ia64/include/asm/dma-mapping.h +++ b/arch/ia64/include/asm/dma-mapping.h | |||
@@ -27,12 +27,6 @@ extern void machvec_dma_sync_sg(struct device *, struct scatterlist *, int, | |||
27 | 27 | ||
28 | #include <asm-generic/dma-mapping-common.h> | 28 | #include <asm-generic/dma-mapping-common.h> |
29 | 29 | ||
30 | static inline int dma_supported(struct device *dev, u64 mask) | ||
31 | { | ||
32 | struct dma_map_ops *ops = platform_dma_get_ops(dev); | ||
33 | return ops->dma_supported(dev, mask); | ||
34 | } | ||
35 | |||
36 | static inline int | 30 | static inline int |
37 | dma_set_mask (struct device *dev, u64 mask) | 31 | dma_set_mask (struct device *dev, u64 mask) |
38 | { | 32 | { |
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h index e5b843839263..3b453c503a43 100644 --- a/arch/microblaze/include/asm/dma-mapping.h +++ b/arch/microblaze/include/asm/dma-mapping.h | |||
@@ -44,16 +44,7 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) | |||
44 | return &dma_direct_ops; | 44 | return &dma_direct_ops; |
45 | } | 45 | } |
46 | 46 | ||
47 | static inline int dma_supported(struct device *dev, u64 mask) | 47 | #include <asm-generic/dma-mapping-common.h> |
48 | { | ||
49 | struct dma_map_ops *ops = get_dma_ops(dev); | ||
50 | |||
51 | if (unlikely(!ops)) | ||
52 | return 0; | ||
53 | if (!ops->dma_supported) | ||
54 | return 1; | ||
55 | return ops->dma_supported(dev, mask); | ||
56 | } | ||
57 | 48 | ||
58 | static inline int dma_set_mask(struct device *dev, u64 dma_mask) | 49 | static inline int dma_set_mask(struct device *dev, u64 dma_mask) |
59 | { | 50 | { |
@@ -69,8 +60,6 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask) | |||
69 | return 0; | 60 | return 0; |
70 | } | 61 | } |
71 | 62 | ||
72 | #include <asm-generic/dma-mapping-common.h> | ||
73 | |||
74 | static inline void __dma_sync(unsigned long paddr, | 63 | static inline void __dma_sync(unsigned long paddr, |
75 | size_t size, enum dma_data_direction direction) | 64 | size_t size, enum dma_data_direction direction) |
76 | { | 65 | { |
diff --git a/arch/mips/include/asm/dma-mapping.h b/arch/mips/include/asm/dma-mapping.h index 158bb36bdcb4..8bf8ec30a4b2 100644 --- a/arch/mips/include/asm/dma-mapping.h +++ b/arch/mips/include/asm/dma-mapping.h | |||
@@ -31,12 +31,6 @@ static inline void dma_mark_clean(void *addr, size_t size) {} | |||
31 | 31 | ||
32 | #include <asm-generic/dma-mapping-common.h> | 32 | #include <asm-generic/dma-mapping-common.h> |
33 | 33 | ||
34 | static inline int dma_supported(struct device *dev, u64 mask) | ||
35 | { | ||
36 | struct dma_map_ops *ops = get_dma_ops(dev); | ||
37 | return ops->dma_supported(dev, mask); | ||
38 | } | ||
39 | |||
40 | static inline int | 34 | static inline int |
41 | dma_set_mask(struct device *dev, u64 mask) | 35 | dma_set_mask(struct device *dev, u64 mask) |
42 | { | 36 | { |
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h index 7dfe9d50856e..8fc08b883477 100644 --- a/arch/openrisc/include/asm/dma-mapping.h +++ b/arch/openrisc/include/asm/dma-mapping.h | |||
@@ -35,14 +35,15 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) | |||
35 | return &or1k_dma_map_ops; | 35 | return &or1k_dma_map_ops; |
36 | } | 36 | } |
37 | 37 | ||
38 | #include <asm-generic/dma-mapping-common.h> | 38 | #define HAVE_ARCH_DMA_SUPPORTED 1 |
39 | |||
40 | static inline int dma_supported(struct device *dev, u64 dma_mask) | 39 | static inline int dma_supported(struct device *dev, u64 dma_mask) |
41 | { | 40 | { |
42 | /* Support 32 bit DMA mask exclusively */ | 41 | /* Support 32 bit DMA mask exclusively */ |
43 | return dma_mask == DMA_BIT_MASK(32); | 42 | return dma_mask == DMA_BIT_MASK(32); |
44 | } | 43 | } |
45 | 44 | ||
45 | #include <asm-generic/dma-mapping-common.h> | ||
46 | |||
46 | static inline int dma_set_mask(struct device *dev, u64 dma_mask) | 47 | static inline int dma_set_mask(struct device *dev, u64 dma_mask) |
47 | { | 48 | { |
48 | if (!dev->dma_mask || !dma_supported(dev, dma_mask)) | 49 | if (!dev->dma_mask || !dma_supported(dev, dma_mask)) |
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 712d5afc055a..dd43e0c6f219 100644 --- a/arch/powerpc/include/asm/dma-mapping.h +++ b/arch/powerpc/include/asm/dma-mapping.h | |||
@@ -124,17 +124,6 @@ static inline void set_dma_offset(struct device *dev, dma_addr_t off) | |||
124 | 124 | ||
125 | #include <asm-generic/dma-mapping-common.h> | 125 | #include <asm-generic/dma-mapping-common.h> |
126 | 126 | ||
127 | static inline int dma_supported(struct device *dev, u64 mask) | ||
128 | { | ||
129 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | ||
130 | |||
131 | if (unlikely(dma_ops == NULL)) | ||
132 | return 0; | ||
133 | if (dma_ops->dma_supported == NULL) | ||
134 | return 1; | ||
135 | return dma_ops->dma_supported(dev, mask); | ||
136 | } | ||
137 | |||
138 | extern int dma_set_mask(struct device *dev, u64 dma_mask); | 127 | extern int dma_set_mask(struct device *dev, u64 dma_mask); |
139 | extern int __dma_set_mask(struct device *dev, u64 dma_mask); | 128 | extern int __dma_set_mask(struct device *dev, u64 dma_mask); |
140 | extern u64 __dma_get_required_mask(struct device *dev); | 129 | extern u64 __dma_get_required_mask(struct device *dev); |
diff --git a/arch/s390/include/asm/dma-mapping.h b/arch/s390/include/asm/dma-mapping.h index 3c293291319b..1f42489797da 100644 --- a/arch/s390/include/asm/dma-mapping.h +++ b/arch/s390/include/asm/dma-mapping.h | |||
@@ -27,15 +27,6 @@ static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | |||
27 | 27 | ||
28 | #include <asm-generic/dma-mapping-common.h> | 28 | #include <asm-generic/dma-mapping-common.h> |
29 | 29 | ||
30 | static inline int dma_supported(struct device *dev, u64 mask) | ||
31 | { | ||
32 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | ||
33 | |||
34 | if (dma_ops->dma_supported == NULL) | ||
35 | return 1; | ||
36 | return dma_ops->dma_supported(dev, mask); | ||
37 | } | ||
38 | |||
39 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | 30 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) |
40 | { | 31 | { |
41 | if (!dev->dma_mask) | 32 | if (!dev->dma_mask) |
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h index 98308c497162..088f6e5f1a92 100644 --- a/arch/sh/include/asm/dma-mapping.h +++ b/arch/sh/include/asm/dma-mapping.h | |||
@@ -13,16 +13,6 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) | |||
13 | 13 | ||
14 | #include <asm-generic/dma-mapping-common.h> | 14 | #include <asm-generic/dma-mapping-common.h> |
15 | 15 | ||
16 | static inline int dma_supported(struct device *dev, u64 mask) | ||
17 | { | ||
18 | struct dma_map_ops *ops = get_dma_ops(dev); | ||
19 | |||
20 | if (ops->dma_supported) | ||
21 | return ops->dma_supported(dev, mask); | ||
22 | |||
23 | return 1; | ||
24 | } | ||
25 | |||
26 | static inline int dma_set_mask(struct device *dev, u64 mask) | 16 | static inline int dma_set_mask(struct device *dev, u64 mask) |
27 | { | 17 | { |
28 | struct dma_map_ops *ops = get_dma_ops(dev); | 18 | struct dma_map_ops *ops = get_dma_ops(dev); |
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h index 5069d137453b..184651bb0b46 100644 --- a/arch/sparc/include/asm/dma-mapping.h +++ b/arch/sparc/include/asm/dma-mapping.h | |||
@@ -7,6 +7,7 @@ | |||
7 | 7 | ||
8 | #define DMA_ERROR_CODE (~(dma_addr_t)0x0) | 8 | #define DMA_ERROR_CODE (~(dma_addr_t)0x0) |
9 | 9 | ||
10 | #define HAVE_ARCH_DMA_SUPPORTED 1 | ||
10 | int dma_supported(struct device *dev, u64 mask); | 11 | int dma_supported(struct device *dev, u64 mask); |
11 | 12 | ||
12 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, | 13 | static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, |
diff --git a/arch/tile/include/asm/dma-mapping.h b/arch/tile/include/asm/dma-mapping.h index f8f7a05023bf..559ed4a60077 100644 --- a/arch/tile/include/asm/dma-mapping.h +++ b/arch/tile/include/asm/dma-mapping.h | |||
@@ -75,12 +75,6 @@ static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | |||
75 | } | 75 | } |
76 | 76 | ||
77 | static inline int | 77 | static inline int |
78 | dma_supported(struct device *dev, u64 mask) | ||
79 | { | ||
80 | return get_dma_ops(dev)->dma_supported(dev, mask); | ||
81 | } | ||
82 | |||
83 | static inline int | ||
84 | dma_set_mask(struct device *dev, u64 mask) | 78 | dma_set_mask(struct device *dev, u64 mask) |
85 | { | 79 | { |
86 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | 80 | struct dma_map_ops *dma_ops = get_dma_ops(dev); |
diff --git a/arch/unicore32/include/asm/dma-mapping.h b/arch/unicore32/include/asm/dma-mapping.h index 175d7e3f7b0a..21231c14182c 100644 --- a/arch/unicore32/include/asm/dma-mapping.h +++ b/arch/unicore32/include/asm/dma-mapping.h | |||
@@ -28,16 +28,6 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) | |||
28 | return &swiotlb_dma_map_ops; | 28 | return &swiotlb_dma_map_ops; |
29 | } | 29 | } |
30 | 30 | ||
31 | static inline int dma_supported(struct device *dev, u64 mask) | ||
32 | { | ||
33 | struct dma_map_ops *dma_ops = get_dma_ops(dev); | ||
34 | |||
35 | if (unlikely(dma_ops == NULL)) | ||
36 | return 0; | ||
37 | |||
38 | return dma_ops->dma_supported(dev, mask); | ||
39 | } | ||
40 | |||
41 | #include <asm-generic/dma-mapping-common.h> | 31 | #include <asm-generic/dma-mapping-common.h> |
42 | 32 | ||
43 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) | 33 | static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size) |
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h index bbca62e3e43f..b1fbf582048b 100644 --- a/arch/x86/include/asm/dma-mapping.h +++ b/arch/x86/include/asm/dma-mapping.h | |||
@@ -43,9 +43,11 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) | |||
43 | bool arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp); | 43 | bool arch_dma_alloc_attrs(struct device **dev, gfp_t *gfp); |
44 | #define arch_dma_alloc_attrs arch_dma_alloc_attrs | 44 | #define arch_dma_alloc_attrs arch_dma_alloc_attrs |
45 | 45 | ||
46 | #define HAVE_ARCH_DMA_SUPPORTED 1 | ||
47 | extern int dma_supported(struct device *hwdev, u64 mask); | ||
48 | |||
46 | #include <asm-generic/dma-mapping-common.h> | 49 | #include <asm-generic/dma-mapping-common.h> |
47 | 50 | ||
48 | extern int dma_supported(struct device *hwdev, u64 mask); | ||
49 | extern int dma_set_mask(struct device *dev, u64 mask); | 51 | extern int dma_set_mask(struct device *dev, u64 mask); |
50 | 52 | ||
51 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, | 53 | extern void *dma_generic_alloc_coherent(struct device *dev, size_t size, |
diff --git a/arch/xtensa/include/asm/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h index 21925bfdaff7..329abc7211e9 100644 --- a/arch/xtensa/include/asm/dma-mapping.h +++ b/arch/xtensa/include/asm/dma-mapping.h | |||
@@ -33,12 +33,6 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev) | |||
33 | #include <asm-generic/dma-mapping-common.h> | 33 | #include <asm-generic/dma-mapping-common.h> |
34 | 34 | ||
35 | static inline int | 35 | static inline int |
36 | dma_supported(struct device *dev, u64 mask) | ||
37 | { | ||
38 | return 1; | ||
39 | } | ||
40 | |||
41 | static inline int | ||
42 | dma_set_mask(struct device *dev, u64 mask) | 36 | dma_set_mask(struct device *dev, u64 mask) |
43 | { | 37 | { |
44 | if(!dev->dma_mask || !dma_supported(dev, mask)) | 38 | if(!dev->dma_mask || !dma_supported(dev, mask)) |
diff --git a/include/asm-generic/dma-mapping-common.h b/include/asm-generic/dma-mapping-common.h index cdaa24193d4c..67fa6bcd644c 100644 --- a/include/asm-generic/dma-mapping-common.h +++ b/include/asm-generic/dma-mapping-common.h | |||
@@ -327,4 +327,17 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr) | |||
327 | #endif | 327 | #endif |
328 | } | 328 | } |
329 | 329 | ||
330 | #ifndef HAVE_ARCH_DMA_SUPPORTED | ||
331 | static inline int dma_supported(struct device *dev, u64 mask) | ||
332 | { | ||
333 | struct dma_map_ops *ops = get_dma_ops(dev); | ||
334 | |||
335 | if (!ops) | ||
336 | return 0; | ||
337 | if (!ops->dma_supported) | ||
338 | return 1; | ||
339 | return ops->dma_supported(dev, mask); | ||
340 | } | ||
341 | #endif | ||
342 | |||
330 | #endif | 343 | #endif |