1 #ifndef __ASM_ARM_ATOMIC_H_WRAPPER
2 #define __ASM_ARM_ATOMIC_H_WRAPPER 1
4 #include_next <asm/atomic.h>
8 #if __LINUX_ARM_ARCH__ >= 6
10 static inline int atomic_cmpxchg(atomic_t *ptr, int old, int new)
12 unsigned long oldval, res;
15 __asm__ __volatile__("@ atomic_cmpxchg\n"
19 "strexeq %0, %4, [%2]\n"
20 : "=&r" (res), "=&r" (oldval)
21 : "r" (&ptr->counter), "Ir" (old), "r" (new)
28 #else /* ARM_ARCH_6 */
30 #include <asm/system.h>
33 #error SMP not supported on pre-ARMv6 CPUs
36 static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
41 local_irq_save(flags);
43 if (likely(ret == old))
45 local_irq_restore(flags);
50 #endif /* __LINUX_ARM_ARCH__ */
52 #endif /* __KERNEL__ */
54 #endif /* asm/atomic.h */