Go to the documentation of this file.
6 #ifndef __ASM_GENERIC_CMPXCHG_H
7 #define __ASM_GENERIC_CMPXCHG_H
10 #error "Cannot use generic cmpxchg on SMP"
13 #include <linux/types.h>
25 unsigned long __xchg(
unsigned long x,
volatile void *
ptr,
int size)
32 return __xchg_u8(x, ptr);
35 ret = *(
volatile u8 *)ptr;
36 *(
volatile u8 *)ptr = x;
43 return __xchg_u16(x, ptr);
46 ret = *(
volatile u16 *)ptr;
47 *(
volatile u16 *)ptr = x;
54 return __xchg_u32(x, ptr);
57 ret = *(
volatile u32 *)ptr;
58 *(
volatile u32 *)ptr = x;
69 ret = *(
volatile u64 *)ptr;
70 *(
volatile u64 *)ptr = x;
82 #define xchg(ptr, x) \
83 ((__typeof__(*(ptr))) __xchg((unsigned long)(x), (ptr), sizeof(*(ptr))))
95 #define cmpxchg(ptr, o, n) cmpxchg_local((ptr), (o), (n))
96 #define cmpxchg64(ptr, o, n) cmpxchg64_local((ptr), (o), (n))