diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2009-11-24 08:16:02 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-12-01 11:21:25 -0500 |
commit | c677189af9faa3f26fae0fcb7ac59f477048b89a (patch) | |
tree | 617d481b1c46c6a0ccdb4404ba84b25657b3128a /arch | |
parent | 2b5e63f6b8f6566161a261a9face1de433d6608e (diff) |
MIPS: Fix build error if __xchg() is not getting inlined.
If __xchg() is not getting inlined the outline version of the function
will have a reference to __xchg_called_with_bad_pointer() which does not
exist remaining. Fixed by using BUILD_BUG_ON() to check for allowable
operand sizes.
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Patchwork: http://patchwork.linux-mips.org/patch/705/
Diffstat (limited to 'arch')
-rw-r--r-- | arch/mips/include/asm/system.h | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/arch/mips/include/asm/system.h b/arch/mips/include/asm/system.h index fcf5f98d90cc..83b5509e09e8 100644 --- a/arch/mips/include/asm/system.h +++ b/arch/mips/include/asm/system.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #ifndef _ASM_SYSTEM_H | 12 | #ifndef _ASM_SYSTEM_H |
13 | #define _ASM_SYSTEM_H | 13 | #define _ASM_SYSTEM_H |
14 | 14 | ||
15 | #include <linux/kernel.h> | ||
15 | #include <linux/types.h> | 16 | #include <linux/types.h> |
16 | #include <linux/irqflags.h> | 17 | #include <linux/irqflags.h> |
17 | 18 | ||
@@ -193,10 +194,6 @@ extern __u64 __xchg_u64_unsupported_on_32bit_kernels(volatile __u64 * m, __u64 v | |||
193 | #define __xchg_u64 __xchg_u64_unsupported_on_32bit_kernels | 194 | #define __xchg_u64 __xchg_u64_unsupported_on_32bit_kernels |
194 | #endif | 195 | #endif |
195 | 196 | ||
196 | /* This function doesn't exist, so you'll get a linker error | ||
197 | if something tries to do an invalid xchg(). */ | ||
198 | extern void __xchg_called_with_bad_pointer(void); | ||
199 | |||
200 | static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) | 197 | static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) |
201 | { | 198 | { |
202 | switch (size) { | 199 | switch (size) { |
@@ -205,11 +202,17 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz | |||
205 | case 8: | 202 | case 8: |
206 | return __xchg_u64(ptr, x); | 203 | return __xchg_u64(ptr, x); |
207 | } | 204 | } |
208 | __xchg_called_with_bad_pointer(); | 205 | |
209 | return x; | 206 | return x; |
210 | } | 207 | } |
211 | 208 | ||
212 | #define xchg(ptr, x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) | 209 | #define xchg(ptr, x) \ |
210 | ({ \ | ||
211 | BUILD_BUG_ON(sizeof(*(ptr)) & ~0xc); \ | ||
212 | \ | ||
213 | ((__typeof__(*(ptr))) \ | ||
214 | __xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))); \ | ||
215 | }) | ||
213 | 216 | ||
214 | extern void set_handler(unsigned long offset, void *addr, unsigned long len); | 217 | extern void set_handler(unsigned long offset, void *addr, unsigned long len); |
215 | extern void set_uncached_handler(unsigned long offset, void *addr, unsigned long len); | 218 | extern void set_uncached_handler(unsigned long offset, void *addr, unsigned long len); |