diff options
Diffstat (limited to 'arch/mips/include/asm/system.h')
-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 fcf5f98d90c..83b5509e09e 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); |