aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-x86/cmpxchg_32.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-x86/cmpxchg_32.h')
-rw-r--r--include/asm-x86/cmpxchg_32.h32
1 files changed, 20 insertions, 12 deletions
diff --git a/include/asm-x86/cmpxchg_32.h b/include/asm-x86/cmpxchg_32.h
index cea1dae288a7..959fad00dff5 100644
--- a/include/asm-x86/cmpxchg_32.h
+++ b/include/asm-x86/cmpxchg_32.h
@@ -269,22 +269,26 @@ static inline unsigned long cmpxchg_386(volatile void *ptr, unsigned long old,
269({ \ 269({ \
270 __typeof__(*(ptr)) __ret; \ 270 __typeof__(*(ptr)) __ret; \
271 if (likely(boot_cpu_data.x86 > 3)) \ 271 if (likely(boot_cpu_data.x86 > 3)) \
272 __ret = __cmpxchg((ptr), (unsigned long)(o), \ 272 __ret = (__typeof__(*(ptr)))__cmpxchg((ptr), \
273 (unsigned long)(n), sizeof(*(ptr))); \ 273 (unsigned long)(o), (unsigned long)(n), \
274 sizeof(*(ptr))); \
274 else \ 275 else \
275 __ret = cmpxchg_386((ptr), (unsigned long)(o), \ 276 __ret = (__typeof__(*(ptr)))cmpxchg_386((ptr), \
276 (unsigned long)(n), sizeof(*(ptr))); \ 277 (unsigned long)(o), (unsigned long)(n), \
278 sizeof(*(ptr))); \
277 __ret; \ 279 __ret; \
278}) 280})
279#define cmpxchg_local(ptr, o, n) \ 281#define cmpxchg_local(ptr, o, n) \
280({ \ 282({ \
281 __typeof__(*(ptr)) __ret; \ 283 __typeof__(*(ptr)) __ret; \
282 if (likely(boot_cpu_data.x86 > 3)) \ 284 if (likely(boot_cpu_data.x86 > 3)) \
283 __ret = __cmpxchg_local((ptr), (unsigned long)(o), \ 285 __ret = (__typeof__(*(ptr)))__cmpxchg_local((ptr), \
284 (unsigned long)(n), sizeof(*(ptr))); \ 286 (unsigned long)(o), (unsigned long)(n), \
287 sizeof(*(ptr))); \
285 else \ 288 else \
286 __ret = cmpxchg_386((ptr), (unsigned long)(o), \ 289 __ret = (__typeof__(*(ptr)))cmpxchg_386((ptr), \
287 (unsigned long)(n), sizeof(*(ptr))); \ 290 (unsigned long)(o), (unsigned long)(n), \
291 sizeof(*(ptr))); \
288 __ret; \ 292 __ret; \
289}) 293})
290#endif 294#endif
@@ -301,10 +305,12 @@ extern unsigned long long cmpxchg_486_u64(volatile void *, u64, u64);
301({ \ 305({ \
302 __typeof__(*(ptr)) __ret; \ 306 __typeof__(*(ptr)) __ret; \
303 if (likely(boot_cpu_data.x86 > 4)) \ 307 if (likely(boot_cpu_data.x86 > 4)) \
304 __ret = __cmpxchg64((ptr), (unsigned long long)(o), \ 308 __ret = (__typeof__(*(ptr)))__cmpxchg64((ptr), \
309 (unsigned long long)(o), \
305 (unsigned long long)(n)); \ 310 (unsigned long long)(n)); \
306 else \ 311 else \
307 __ret = cmpxchg_486_u64((ptr), (unsigned long long)(o), \ 312 __ret = (__typeof__(*(ptr)))cmpxchg_486_u64((ptr), \
313 (unsigned long long)(o), \
308 (unsigned long long)(n)); \ 314 (unsigned long long)(n)); \
309 __ret; \ 315 __ret; \
310}) 316})
@@ -312,10 +318,12 @@ extern unsigned long long cmpxchg_486_u64(volatile void *, u64, u64);
312({ \ 318({ \
313 __typeof__(*(ptr)) __ret; \ 319 __typeof__(*(ptr)) __ret; \
314 if (likely(boot_cpu_data.x86 > 4)) \ 320 if (likely(boot_cpu_data.x86 > 4)) \
315 __ret = __cmpxchg64_local((ptr), (unsigned long long)(o), \ 321 __ret = (__typeof__(*(ptr)))__cmpxchg64_local((ptr), \
322 (unsigned long long)(o), \
316 (unsigned long long)(n)); \ 323 (unsigned long long)(n)); \
317 else \ 324 else \
318 __ret = cmpxchg_486_u64((ptr), (unsigned long long)(o), \ 325 __ret = (__typeof__(*(ptr)))cmpxchg_486_u64((ptr), \
326 (unsigned long long)(o), \
319 (unsigned long long)(n)); \ 327 (unsigned long long)(n)); \
320 __ret; \ 328 __ret; \
321}) 329})