IB/ipath: Use unsigned long for irq flags
[linux-2.6] / include / asm-sh / cmpxchg-irq.h
1 #ifndef __ASM_SH_CMPXCHG_IRQ_H
2 #define __ASM_SH_CMPXCHG_IRQ_H
3
4 static inline unsigned long xchg_u32(volatile u32 *m, unsigned long val)
5 {
6         unsigned long flags, retval;
7
8         local_irq_save(flags);
9         retval = *m;
10         *m = val;
11         local_irq_restore(flags);
12         return retval;
13 }
14
15 static inline unsigned long xchg_u8(volatile u8 *m, unsigned long val)
16 {
17         unsigned long flags, retval;
18
19         local_irq_save(flags);
20         retval = *m;
21         *m = val & 0xff;
22         local_irq_restore(flags);
23         return retval;
24 }
25
26 static inline unsigned long __cmpxchg_u32(volatile int *m, unsigned long old,
27         unsigned long new)
28 {
29         __u32 retval;
30         unsigned long flags;
31
32         local_irq_save(flags);
33         retval = *m;
34         if (retval == old)
35                 *m = new;
36         local_irq_restore(flags);       /* implies memory barrier  */
37         return retval;
38 }
39
40 #endif /* __ASM_SH_CMPXCHG_IRQ_H */