diff options
author | Paul Mundt <lethal@linux-sh.org> | 2008-11-20 01:25:22 -0500 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2008-12-22 04:42:53 -0500 |
commit | 16b529d1d78060254d5bc735390915ca5ccf13a1 (patch) | |
tree | 6e28039e44bb1faa421d38a611f352da1f70697b | |
parent | 709420dd4e75083ee7920e61c2d0bcc3db9b7405 (diff) |
sh: Convert to generic bitops for IRQ-toggling implementation.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/include/asm/bitops-grb.h | 3 | ||||
-rw-r--r-- | arch/sh/include/asm/bitops-irq.h | 91 | ||||
-rw-r--r-- | arch/sh/include/asm/bitops-llsc.h | 2 | ||||
-rw-r--r-- | arch/sh/include/asm/bitops.h | 6 |
4 files changed, 7 insertions, 95 deletions
diff --git a/arch/sh/include/asm/bitops-grb.h b/arch/sh/include/asm/bitops-grb.h index a5907b94395b..e73af33acbf4 100644 --- a/arch/sh/include/asm/bitops-grb.h +++ b/arch/sh/include/asm/bitops-grb.h | |||
@@ -166,4 +166,7 @@ static inline int test_and_change_bit(int nr, volatile void * addr) | |||
166 | 166 | ||
167 | return retval; | 167 | return retval; |
168 | } | 168 | } |
169 | |||
170 | #include <asm-generic/bitops/non-atomic.h> | ||
171 | |||
169 | #endif /* __ASM_SH_BITOPS_GRB_H */ | 172 | #endif /* __ASM_SH_BITOPS_GRB_H */ |
diff --git a/arch/sh/include/asm/bitops-irq.h b/arch/sh/include/asm/bitops-irq.h deleted file mode 100644 index 653a12750584..000000000000 --- a/arch/sh/include/asm/bitops-irq.h +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | #ifndef __ASM_SH_BITOPS_IRQ_H | ||
2 | #define __ASM_SH_BITOPS_IRQ_H | ||
3 | |||
4 | static inline void set_bit(int nr, volatile void *addr) | ||
5 | { | ||
6 | int mask; | ||
7 | volatile unsigned int *a = addr; | ||
8 | unsigned long flags; | ||
9 | |||
10 | a += nr >> 5; | ||
11 | mask = 1 << (nr & 0x1f); | ||
12 | local_irq_save(flags); | ||
13 | *a |= mask; | ||
14 | local_irq_restore(flags); | ||
15 | } | ||
16 | |||
17 | static inline void clear_bit(int nr, volatile void *addr) | ||
18 | { | ||
19 | int mask; | ||
20 | volatile unsigned int *a = addr; | ||
21 | unsigned long flags; | ||
22 | |||
23 | a += nr >> 5; | ||
24 | mask = 1 << (nr & 0x1f); | ||
25 | local_irq_save(flags); | ||
26 | *a &= ~mask; | ||
27 | local_irq_restore(flags); | ||
28 | } | ||
29 | |||
30 | static inline void change_bit(int nr, volatile void *addr) | ||
31 | { | ||
32 | int mask; | ||
33 | volatile unsigned int *a = addr; | ||
34 | unsigned long flags; | ||
35 | |||
36 | a += nr >> 5; | ||
37 | mask = 1 << (nr & 0x1f); | ||
38 | local_irq_save(flags); | ||
39 | *a ^= mask; | ||
40 | local_irq_restore(flags); | ||
41 | } | ||
42 | |||
43 | static inline int test_and_set_bit(int nr, volatile void *addr) | ||
44 | { | ||
45 | int mask, retval; | ||
46 | volatile unsigned int *a = addr; | ||
47 | unsigned long flags; | ||
48 | |||
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); | ||
55 | |||
56 | return retval; | ||
57 | } | ||
58 | |||
59 | static inline int test_and_clear_bit(int nr, volatile void *addr) | ||
60 | { | ||
61 | int mask, retval; | ||
62 | volatile unsigned int *a = addr; | ||
63 | unsigned long flags; | ||
64 | |||
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); | ||
71 | |||
72 | return retval; | ||
73 | } | ||
74 | |||
75 | static inline int test_and_change_bit(int nr, volatile void *addr) | ||
76 | { | ||
77 | int mask, retval; | ||
78 | volatile unsigned int *a = addr; | ||
79 | unsigned long flags; | ||
80 | |||
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); | ||
87 | |||
88 | return retval; | ||
89 | } | ||
90 | |||
91 | #endif /* __ASM_SH_BITOPS_IRQ_H */ | ||
diff --git a/arch/sh/include/asm/bitops-llsc.h b/arch/sh/include/asm/bitops-llsc.h index 43b8e1a8239e..1d2fc0b010ad 100644 --- a/arch/sh/include/asm/bitops-llsc.h +++ b/arch/sh/include/asm/bitops-llsc.h | |||
@@ -141,4 +141,6 @@ static inline int test_and_change_bit(int nr, volatile void * addr) | |||
141 | return retval != 0; | 141 | return retval != 0; |
142 | } | 142 | } |
143 | 143 | ||
144 | #include <asm-generic/bitops/non-atomic.h> | ||
145 | |||
144 | #endif /* __ASM_SH_BITOPS_LLSC_H */ | 146 | #endif /* __ASM_SH_BITOPS_LLSC_H */ |
diff --git a/arch/sh/include/asm/bitops.h b/arch/sh/include/asm/bitops.h index 367930d8e5ae..9b141e04d10b 100644 --- a/arch/sh/include/asm/bitops.h +++ b/arch/sh/include/asm/bitops.h | |||
@@ -16,18 +16,16 @@ | |||
16 | #elif defined(CONFIG_CPU_SH4A) | 16 | #elif defined(CONFIG_CPU_SH4A) |
17 | #include <asm/bitops-llsc.h> | 17 | #include <asm/bitops-llsc.h> |
18 | #else | 18 | #else |
19 | #include <asm/bitops-irq.h> | 19 | #include <asm-generic/bitops/atomic.h> |
20 | #include <asm-generic/bitops/non-atomic.h> | ||
20 | #endif | 21 | #endif |
21 | 22 | ||
22 | |||
23 | /* | 23 | /* |
24 | * clear_bit() doesn't provide any barrier for the compiler. | 24 | * clear_bit() doesn't provide any barrier for the compiler. |
25 | */ | 25 | */ |
26 | #define smp_mb__before_clear_bit() barrier() | 26 | #define smp_mb__before_clear_bit() barrier() |
27 | #define smp_mb__after_clear_bit() barrier() | 27 | #define smp_mb__after_clear_bit() barrier() |
28 | 28 | ||
29 | #include <asm-generic/bitops/non-atomic.h> | ||
30 | |||
31 | #ifdef CONFIG_SUPERH32 | 29 | #ifdef CONFIG_SUPERH32 |
32 | static inline unsigned long ffz(unsigned long word) | 30 | static inline unsigned long ffz(unsigned long word) |
33 | { | 31 | { |