diff options
author | Ingo Molnar <mingo@kernel.org> | 2017-05-05 08:20:52 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2017-05-05 08:21:03 +0200 |
commit | 415812f2d6b856d33ede9bf4a2b95575dbbb3d4e (patch) | |
tree | 4daf9ca52f89ea59453538b406f584d47c77aff3 /arch/avr32/include/asm/cmpxchg.h | |
parent | x86/asm: Don't use RBP as a temporary register in csum_partial_copy_generic() (diff) | |
parent | Merge branch 'x86-mm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/... (diff) | |
download | linux-415812f2d6b856d33ede9bf4a2b95575dbbb3d4e.tar.xz linux-415812f2d6b856d33ede9bf4a2b95575dbbb3d4e.zip |
Merge branch 'linus' into x86/urgent, to pick up dependent commits
We are going to fix a bug introduced by a more recent commit, so
refresh the tree.
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/avr32/include/asm/cmpxchg.h')
-rw-r--r-- | arch/avr32/include/asm/cmpxchg.h | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/arch/avr32/include/asm/cmpxchg.h b/arch/avr32/include/asm/cmpxchg.h deleted file mode 100644 index 572739b4c4b4..000000000000 --- a/arch/avr32/include/asm/cmpxchg.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Atomic operations that C can't guarantee us. Useful for - * resource counting etc. - * - * But use these as seldom as possible since they are slower than - * regular operations. - * - * Copyright (C) 2004-2006 Atmel Corporation - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ -#ifndef __ASM_AVR32_CMPXCHG_H -#define __ASM_AVR32_CMPXCHG_H - -#define xchg(ptr,x) \ - ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) - -extern void __xchg_called_with_bad_pointer(void); - -static inline unsigned long xchg_u32(u32 val, volatile u32 *m) -{ - u32 ret; - - asm volatile("xchg %[ret], %[m], %[val]" - : [ret] "=&r"(ret), "=m"(*m) - : "m"(*m), [m] "r"(m), [val] "r"(val) - : "memory"); - return ret; -} - -static inline unsigned long __xchg(unsigned long x, - volatile void *ptr, - int size) -{ - switch(size) { - case 4: - return xchg_u32(x, ptr); - default: - __xchg_called_with_bad_pointer(); - return x; - } -} - -static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old, - unsigned long new) -{ - __u32 ret; - - asm volatile( - "1: ssrf 5\n" - " ld.w %[ret], %[m]\n" - " cp.w %[ret], %[old]\n" - " brne 2f\n" - " stcond %[m], %[new]\n" - " brne 1b\n" - "2:\n" - : [ret] "=&r"(ret), [m] "=m"(*m) - : "m"(m), [old] "Ks21r"(old), [new] "r"(new) - : "memory", "cc"); - return ret; -} - -extern unsigned long __cmpxchg_u64_unsupported_on_32bit_kernels( - volatile int * m, unsigned long old, unsigned long new); -#define __cmpxchg_u64 __cmpxchg_u64_unsupported_on_32bit_kernels - -/* This function doesn't exist, so you'll get a linker error - if something tries to do an invalid cmpxchg(). */ -extern void __cmpxchg_called_with_bad_pointer(void); - -static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old, - unsigned long new, int size) -{ - switch (size) { - case 4: - return __cmpxchg_u32(ptr, old, new); - case 8: - return __cmpxchg_u64(ptr, old, new); - } - - __cmpxchg_called_with_bad_pointer(); - return old; -} - -#define cmpxchg(ptr, old, new) \ - ((typeof(*(ptr)))__cmpxchg((ptr), (unsigned long)(old), \ - (unsigned long)(new), \ - sizeof(*(ptr)))) - -#include <asm-generic/cmpxchg-local.h> - -static inline unsigned long __cmpxchg_local(volatile void *ptr, - unsigned long old, - unsigned long new, int size) -{ - switch (size) { - case 4: - return __cmpxchg_u32(ptr, old, new); - default: - return __cmpxchg_local_generic(ptr, old, new, size); - } - - return old; -} - -#define cmpxchg_local(ptr, old, new) \ - ((typeof(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(old), \ - (unsigned long)(new), \ - sizeof(*(ptr)))) - -#define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), (o), (n)) - -#endif /* __ASM_AVR32_CMPXCHG_H */ |