From b5daf28163b8c8fb682a52ceade20cc91082aaf8 Mon Sep 17 00:00:00 2001 From: Ralf Baechle Date: Tue, 24 Nov 2009 13:16:02 +0000 Subject: [PATCH] --- yaml --- r: 169035 b: refs/heads/master c: c677189af9faa3f26fae0fcb7ac59f477048b89a h: refs/heads/master i: 169033: 659cde361559a30be4a17017a1bbe9601b7f4ff3 169031: e8d2c89a935776c3ea24dcf1de7e45b3a1429e4b v: v3 --- [refs] | 2 +- trunk/arch/mips/include/asm/system.h | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 56982ed8cd42..6bfc50009a87 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 2b5e63f6b8f6566161a261a9face1de433d6608e +refs/heads/master: c677189af9faa3f26fae0fcb7ac59f477048b89a diff --git a/trunk/arch/mips/include/asm/system.h b/trunk/arch/mips/include/asm/system.h index fcf5f98d90cc..83b5509e09e8 100644 --- a/trunk/arch/mips/include/asm/system.h +++ b/trunk/arch/mips/include/asm/system.h @@ -12,6 +12,7 @@ #ifndef _ASM_SYSTEM_H #define _ASM_SYSTEM_H +#include #include #include @@ -193,10 +194,6 @@ extern __u64 __xchg_u64_unsupported_on_32bit_kernels(volatile __u64 * m, __u64 v #define __xchg_u64 __xchg_u64_unsupported_on_32bit_kernels #endif -/* This function doesn't exist, so you'll get a linker error - if something tries to do an invalid xchg(). */ -extern void __xchg_called_with_bad_pointer(void); - static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int size) { switch (size) { @@ -205,11 +202,17 @@ static inline unsigned long __xchg(unsigned long x, volatile void * ptr, int siz case 8: return __xchg_u64(ptr, x); } - __xchg_called_with_bad_pointer(); + return x; } -#define xchg(ptr, x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) +#define xchg(ptr, x) \ +({ \ + BUILD_BUG_ON(sizeof(*(ptr)) & ~0xc); \ + \ + ((__typeof__(*(ptr))) \ + __xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))); \ +}) extern void set_handler(unsigned long offset, void *addr, unsigned long len); extern void set_uncached_handler(unsigned long offset, void *addr, unsigned long len);