can: gw: make routing to the incoming CAN interface configurable
[linux/fpc-iii.git] / arch / sh / include / asm / cmpxchg-irq.h
blobbd11f630414ad173640b937c0576a8a12399a42a
1 #ifndef __ASM_SH_CMPXCHG_IRQ_H
2 #define __ASM_SH_CMPXCHG_IRQ_H
4 #include <linux/irqflags.h>
6 static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val)
8 unsigned long flags, retval;
10 local_irq_save(flags);
11 retval = *m;
12 *m = val;
13 local_irq_restore(flags);
14 return retval;
17 static inline unsigned long xchg_u8(volatile u8 *m, unsigned long val)
19 unsigned long flags, retval;
21 local_irq_save(flags);
22 retval = *m;
23 *m = val & 0xff;
24 local_irq_restore(flags);
25 return retval;
28 static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
29 unsigned long new)
31 __u32 retval;
32 unsigned long flags;
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;
42 #endif /* __ASM_SH_CMPXCHG_IRQ_H */