dlm: recover nodes that are removed and re-added
[linux-2.6/mini2440.git] / include / asm-sh / bitops-irq.h
blob653a12750584628130054485e529a2848f19f76a
1 #ifndef __ASM_SH_BITOPS_IRQ_H
2 #define __ASM_SH_BITOPS_IRQ_H
4 static inline void set_bit(int nr, volatile void *addr)
6 int mask;
7 volatile unsigned int *a = addr;
8 unsigned long flags;
10 a += nr >> 5;
11 mask = 1 << (nr & 0x1f);
12 local_irq_save(flags);
13 *a |= mask;
14 local_irq_restore(flags);
17 static inline void clear_bit(int nr, volatile void *addr)
19 int mask;
20 volatile unsigned int *a = addr;
21 unsigned long flags;
23 a += nr >> 5;
24 mask = 1 << (nr & 0x1f);
25 local_irq_save(flags);
26 *a &= ~mask;
27 local_irq_restore(flags);
30 static inline void change_bit(int nr, volatile void *addr)
32 int mask;
33 volatile unsigned int *a = addr;
34 unsigned long flags;
36 a += nr >> 5;
37 mask = 1 << (nr & 0x1f);
38 local_irq_save(flags);
39 *a ^= mask;
40 local_irq_restore(flags);
43 static inline int test_and_set_bit(int nr, volatile void *addr)
45 int mask, retval;
46 volatile unsigned int *a = addr;
47 unsigned long flags;
49 a += nr >> 5;
50 mask = 1 << (nr & 0x1f);
51 local_irq_save(flags);
52 retval = (mask & *a) != 0;
53 *a |= mask;
54 local_irq_restore(flags);
56 return retval;
59 static inline int test_and_clear_bit(int nr, volatile void *addr)
61 int mask, retval;
62 volatile unsigned int *a = addr;
63 unsigned long flags;
65 a += nr >> 5;
66 mask = 1 << (nr & 0x1f);
67 local_irq_save(flags);
68 retval = (mask & *a) != 0;
69 *a &= ~mask;
70 local_irq_restore(flags);
72 return retval;
75 static inline int test_and_change_bit(int nr, volatile void *addr)
77 int mask, retval;
78 volatile unsigned int *a = addr;
79 unsigned long flags;
81 a += nr >> 5;
82 mask = 1 << (nr & 0x1f);
83 local_irq_save(flags);
84 retval = (mask & *a) != 0;
85 *a ^= mask;
86 local_irq_restore(flags);
88 return retval;
91 #endif /* __ASM_SH_BITOPS_IRQ_H */