| #ifndef __ASM_GENERIC_CMPXCHG_LOCAL_H |
| #define __ASM_GENERIC_CMPXCHG_LOCAL_H |
| #include <linux/irqflags.h> |
| extern unsigned long wrong_size_cmpxchg(volatile void *ptr); |
| * Generic version of __cmpxchg_local (disables interrupts). Takes an unsigned |
| * long parameter, supporting various types of architectures. |
| static inline unsigned long __cmpxchg_local_generic(volatile void *ptr, |
| unsigned long old, unsigned long new, int size) |
| unsigned long flags, prev; |
| * Sanity checking, compile-time. |
| if (size == 8 && sizeof(unsigned long) != 8) |
| case 1: prev = *(u8 *)ptr; |
| case 2: prev = *(u16 *)ptr; |
| case 4: prev = *(u32 *)ptr; |
| case 8: prev = *(u64 *)ptr; |
| local_irq_restore(flags); |
| * Generic version of __cmpxchg64_local. Takes an u64 parameter. |
| static inline u64 __cmpxchg64_local_generic(volatile void *ptr, |
| local_irq_restore(flags); |