Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v3.6 42 lines 825 B view raw
1#ifndef __ASM_SH_CMPXCHG_IRQ_H 2#define __ASM_SH_CMPXCHG_IRQ_H 3 4#include <linux/irqflags.h> 5 6static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val) 7{ 8 unsigned long flags, retval; 9 10 local_irq_save(flags); 11 retval = *m; 12 *m = val; 13 local_irq_restore(flags); 14 return retval; 15} 16 17static inline unsigned long xchg_u8(volatile u8 *m, unsigned long val) 18{ 19 unsigned long flags, retval; 20 21 local_irq_save(flags); 22 retval = *m; 23 *m = val & 0xff; 24 local_irq_restore(flags); 25 return retval; 26} 27 28static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old, 29 unsigned long new) 30{ 31 __u32 retval; 32 unsigned long flags; 33 34 local_irq_save(flags); 35 retval = *m; 36 if (retval == old) 37 *m = new; 38 local_irq_restore(flags); /* implies memory barrier */ 39 return retval; 40} 41 42#endif /* __ASM_SH_CMPXCHG_IRQ_H */