aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-generic/bitops/atomic.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-generic/bitops/atomic.h')
-rw-r--r--include/asm-generic/bitops/atomic.h27
1 files changed, 12 insertions, 15 deletions
diff --git a/include/asm-generic/bitops/atomic.h b/include/asm-generic/bitops/atomic.h
index cd8a9641bd66..4657f3e410fc 100644
--- a/include/asm-generic/bitops/atomic.h
+++ b/include/asm-generic/bitops/atomic.h
@@ -3,9 +3,6 @@
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5 5
6#define BITOP_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
7#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG)
8
9#ifdef CONFIG_SMP 6#ifdef CONFIG_SMP
10#include <asm/spinlock.h> 7#include <asm/spinlock.h>
11#include <asm/cache.h> /* we use L1_CACHE_BYTES */ 8#include <asm/cache.h> /* we use L1_CACHE_BYTES */
@@ -66,8 +63,8 @@ extern raw_spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] __lock_aligned;
66 */ 63 */
67static inline void set_bit(int nr, volatile unsigned long *addr) 64static inline void set_bit(int nr, volatile unsigned long *addr)
68{ 65{
69 unsigned long mask = BITOP_MASK(nr); 66 unsigned long mask = BIT_MASK(nr);
70 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 67 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
71 unsigned long flags; 68 unsigned long flags;
72 69
73 _atomic_spin_lock_irqsave(p, flags); 70 _atomic_spin_lock_irqsave(p, flags);
@@ -87,8 +84,8 @@ static inline void set_bit(int nr, volatile unsigned long *addr)
87 */ 84 */
88static inline void clear_bit(int nr, volatile unsigned long *addr) 85static inline void clear_bit(int nr, volatile unsigned long *addr)
89{ 86{
90 unsigned long mask = BITOP_MASK(nr); 87 unsigned long mask = BIT_MASK(nr);
91 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 88 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
92 unsigned long flags; 89 unsigned long flags;
93 90
94 _atomic_spin_lock_irqsave(p, flags); 91 _atomic_spin_lock_irqsave(p, flags);
@@ -108,8 +105,8 @@ static inline void clear_bit(int nr, volatile unsigned long *addr)
108 */ 105 */
109static inline void change_bit(int nr, volatile unsigned long *addr) 106static inline void change_bit(int nr, volatile unsigned long *addr)
110{ 107{
111 unsigned long mask = BITOP_MASK(nr); 108 unsigned long mask = BIT_MASK(nr);
112 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 109 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
113 unsigned long flags; 110 unsigned long flags;
114 111
115 _atomic_spin_lock_irqsave(p, flags); 112 _atomic_spin_lock_irqsave(p, flags);
@@ -128,8 +125,8 @@ static inline void change_bit(int nr, volatile unsigned long *addr)
128 */ 125 */
129static inline int test_and_set_bit(int nr, volatile unsigned long *addr) 126static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
130{ 127{
131 unsigned long mask = BITOP_MASK(nr); 128 unsigned long mask = BIT_MASK(nr);
132 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 129 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
133 unsigned long old; 130 unsigned long old;
134 unsigned long flags; 131 unsigned long flags;
135 132
@@ -152,8 +149,8 @@ static inline int test_and_set_bit(int nr, volatile unsigned long *addr)
152 */ 149 */
153static inline int test_and_clear_bit(int nr, volatile unsigned long *addr) 150static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
154{ 151{
155 unsigned long mask = BITOP_MASK(nr); 152 unsigned long mask = BIT_MASK(nr);
156 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 153 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
157 unsigned long old; 154 unsigned long old;
158 unsigned long flags; 155 unsigned long flags;
159 156
@@ -175,8 +172,8 @@ static inline int test_and_clear_bit(int nr, volatile unsigned long *addr)
175 */ 172 */
176static inline int test_and_change_bit(int nr, volatile unsigned long *addr) 173static inline int test_and_change_bit(int nr, volatile unsigned long *addr)
177{ 174{
178 unsigned long mask = BITOP_MASK(nr); 175 unsigned long mask = BIT_MASK(nr);
179 unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr); 176 unsigned long *p = ((unsigned long *)addr) + BIT_WORD(nr);
180 unsigned long old; 177 unsigned long old;
181 unsigned long flags; 178 unsigned long flags;
182 179