Commit 32f49eab authored by Mathieu Desnoyers's avatar Mathieu Desnoyers Committed by Linus Torvalds

Add cmpxchg64 and cmpxchg64_local to x86_64

Make sure that at least cmpxchg64_local is available on all architectures to use
for unsigned long long values.
Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Andi Kleen <ak@muc.de>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent f9c4650b
...@@ -124,11 +124,21 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr, ...@@ -124,11 +124,21 @@ static inline unsigned long __cmpxchg_local(volatile void *ptr,
return old; return old;
} }
#define cmpxchg(ptr,o,n)\ #define cmpxchg(ptr, o, n) \
((__typeof__(*(ptr)))__cmpxchg((ptr),(unsigned long)(o),\ ((__typeof__(*(ptr)))__cmpxchg((ptr), (unsigned long)(o), \
(unsigned long)(n),sizeof(*(ptr)))) (unsigned long)(n), sizeof(*(ptr))))
#define cmpxchg_local(ptr,o,n)\ #define cmpxchg64(ptr, o, n) \
((__typeof__(*(ptr)))__cmpxchg_local((ptr),(unsigned long)(o),\ ({ \
(unsigned long)(n),sizeof(*(ptr)))) BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
cmpxchg((ptr), (o), (n)); \
})
#define cmpxchg_local(ptr, o, n) \
((__typeof__(*(ptr)))__cmpxchg_local((ptr), (unsigned long)(o), \
(unsigned long)(n), sizeof(*(ptr))))
#define cmpxchg64_local(ptr, o, n) \
({ \
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
cmpxchg_local((ptr), (o), (n)); \
})
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment