aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm64/include/asm/cmpxchg.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/arch/arm64/include/asm/cmpxchg.h b/arch/arm64/include/asm/cmpxchg.h
index 3914c0dcd09c..56166d7f4a25 100644
--- a/arch/arm64/include/asm/cmpxchg.h
+++ b/arch/arm64/include/asm/cmpxchg.h
@@ -158,17 +158,23 @@ static inline unsigned long __cmpxchg_mb(volatile void *ptr, unsigned long old,
158 return ret; 158 return ret;
159} 159}
160 160
161#define cmpxchg(ptr,o,n) \ 161#define cmpxchg(ptr, o, n) \
162 ((__typeof__(*(ptr)))__cmpxchg_mb((ptr), \ 162({ \
163 (unsigned long)(o), \ 163 __typeof__(*(ptr)) __ret; \
164 (unsigned long)(n), \ 164 __ret = (__typeof__(*(ptr))) \
165 sizeof(*(ptr)))) 165 __cmpxchg_mb((ptr), (unsigned long)(o), (unsigned long)(n), \
166 166 sizeof(*(ptr))); \
167#define cmpxchg_local(ptr,o,n) \ 167 __ret; \
168 ((__typeof__(*(ptr)))__cmpxchg((ptr), \ 168})
169 (unsigned long)(o), \ 169
170 (unsigned long)(n), \ 170#define cmpxchg_local(ptr, o, n) \
171 sizeof(*(ptr)))) 171({ \
172 __typeof__(*(ptr)) __ret; \
173 __ret = (__typeof__(*(ptr))) \
174 __cmpxchg((ptr), (unsigned long)(o), \
175 (unsigned long)(n), sizeof(*(ptr))); \
176 __ret; \
177})
172 178
173#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n)) 179#define cmpxchg64(ptr,o,n) cmpxchg((ptr),(o),(n))
174#define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n)) 180#define cmpxchg64_local(ptr,o,n) cmpxchg_local((ptr),(o),(n))