From: Michal Simek Date: Tue, 21 Jan 2020 13:15:29 +0000 (+0100) Subject: microblaze: Use asm generic cmpxchg.h for !SMP case X-Git-Tag: v5.7-rc1~167^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=519fa60b6007fe19a32c5a50541dd7b38bd11b37;p=thirdparty%2Fkernel%2Flinux.git microblaze: Use asm generic cmpxchg.h for !SMP case The whole implementation is done in asm-generic/cmpxchg.h file and there is no reason to duplicate it. Also do not include asm-generic/cmpxchg-local.h because it is already included from asm-generic/cmpxchg.h Signed-off-by: Michal Simek Reviewed-by: Stefan Asserhall Reviewed-by: Arnd Bergmann --- diff --git a/arch/microblaze/include/asm/cmpxchg.h b/arch/microblaze/include/asm/cmpxchg.h index 596300c745094..3523b51aab363 100644 --- a/arch/microblaze/include/asm/cmpxchg.h +++ b/arch/microblaze/include/asm/cmpxchg.h @@ -2,42 +2,8 @@ #ifndef _ASM_MICROBLAZE_CMPXCHG_H #define _ASM_MICROBLAZE_CMPXCHG_H -#include - -void __bad_xchg(volatile void *ptr, int size); - -static inline unsigned long __xchg(unsigned long x, volatile void *ptr, - int size) -{ - unsigned long ret; - unsigned long flags; - - switch (size) { - case 1: - local_irq_save(flags); - ret = *(volatile unsigned char *)ptr; - *(volatile unsigned char *)ptr = x; - local_irq_restore(flags); - break; - - case 4: - local_irq_save(flags); - ret = *(volatile unsigned long *)ptr; - *(volatile unsigned long *)ptr = x; - local_irq_restore(flags); - break; - default: - __bad_xchg(ptr, size), ret = 0; - break; - } - - return ret; -} - -#define xchg(ptr, x) \ - ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr)))) - -#include -#include +#ifndef CONFIG_SMP +# include +#endif #endif /* _ASM_MICROBLAZE_CMPXCHG_H */