diff options
author | Peter Zijlstra <peterz@infradead.org> | 2014-04-23 13:32:50 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-07-27 08:06:24 -0400 |
commit | e6942b7de2dfe44ebde9bae57dadece5abca9de8 (patch) | |
tree | b235317c5f6d200bcc25b43a406237a0d15319cf | |
parent | 2957c035395e492463d7f589af9dd32388967bbb (diff) |
atomic: Provide atomic_{or,xor,and}
Implement atomic logic ops -- atomic_{or,xor,and}.
These will replace the atomic_{set,clear}_mask functions that are
available on some archs.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
29 files changed, 19 insertions, 68 deletions
diff --git a/arch/alpha/include/asm/atomic.h b/arch/alpha/include/asm/atomic.h index 0eff853398d2..e8c956098424 100644 --- a/arch/alpha/include/asm/atomic.h +++ b/arch/alpha/include/asm/atomic.h | |||
@@ -110,7 +110,6 @@ static __inline__ long atomic64_##op##_return(long i, atomic64_t * v) \ | |||
110 | ATOMIC_OPS(add) | 110 | ATOMIC_OPS(add) |
111 | ATOMIC_OPS(sub) | 111 | ATOMIC_OPS(sub) |
112 | 112 | ||
113 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
114 | #define atomic_andnot atomic_andnot | 113 | #define atomic_andnot atomic_andnot |
115 | #define atomic64_andnot atomic64_andnot | 114 | #define atomic64_andnot atomic64_andnot |
116 | 115 | ||
diff --git a/arch/arc/include/asm/atomic.h b/arch/arc/include/asm/atomic.h index e90b701fc6a8..2a847821dee1 100644 --- a/arch/arc/include/asm/atomic.h +++ b/arch/arc/include/asm/atomic.h | |||
@@ -144,7 +144,6 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ | |||
144 | ATOMIC_OPS(add, +=, add) | 144 | ATOMIC_OPS(add, +=, add) |
145 | ATOMIC_OPS(sub, -=, sub) | 145 | ATOMIC_OPS(sub, -=, sub) |
146 | 146 | ||
147 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
148 | #define atomic_andnot atomic_andnot | 147 | #define atomic_andnot atomic_andnot |
149 | 148 | ||
150 | ATOMIC_OP(and, &=, and) | 149 | ATOMIC_OP(and, &=, and) |
diff --git a/arch/arm/include/asm/atomic.h b/arch/arm/include/asm/atomic.h index ff214bac9cb4..82b75a7cb762 100644 --- a/arch/arm/include/asm/atomic.h +++ b/arch/arm/include/asm/atomic.h | |||
@@ -194,7 +194,6 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) | |||
194 | ATOMIC_OPS(add, +=, add) | 194 | ATOMIC_OPS(add, +=, add) |
195 | ATOMIC_OPS(sub, -=, sub) | 195 | ATOMIC_OPS(sub, -=, sub) |
196 | 196 | ||
197 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
198 | #define atomic_andnot atomic_andnot | 197 | #define atomic_andnot atomic_andnot |
199 | 198 | ||
200 | ATOMIC_OP(and, &=, and) | 199 | ATOMIC_OP(and, &=, and) |
diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h index 2876173397b2..866a71fca9a3 100644 --- a/arch/arm64/include/asm/atomic.h +++ b/arch/arm64/include/asm/atomic.h | |||
@@ -85,7 +85,6 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ | |||
85 | ATOMIC_OPS(add, add) | 85 | ATOMIC_OPS(add, add) |
86 | ATOMIC_OPS(sub, sub) | 86 | ATOMIC_OPS(sub, sub) |
87 | 87 | ||
88 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
89 | #define atomic_andnot atomic_andnot | 88 | #define atomic_andnot atomic_andnot |
90 | 89 | ||
91 | ATOMIC_OP(and, and) | 90 | ATOMIC_OP(and, and) |
diff --git a/arch/avr32/include/asm/atomic.h b/arch/avr32/include/asm/atomic.h index 115d3005e4bc..97c9bdf83409 100644 --- a/arch/avr32/include/asm/atomic.h +++ b/arch/avr32/include/asm/atomic.h | |||
@@ -51,8 +51,6 @@ static inline void atomic_##op(int i, atomic_t *v) \ | |||
51 | (void)__atomic_##op##_return(i, v); \ | 51 | (void)__atomic_##op##_return(i, v); \ |
52 | } | 52 | } |
53 | 53 | ||
54 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
55 | |||
56 | ATOMIC_OP(and, and) | 54 | ATOMIC_OP(and, and) |
57 | ATOMIC_OP(or, or) | 55 | ATOMIC_OP(or, or) |
58 | ATOMIC_OP(xor, eor) | 56 | ATOMIC_OP(xor, eor) |
diff --git a/arch/blackfin/include/asm/atomic.h b/arch/blackfin/include/asm/atomic.h index eafa55b81a7b..2d6a7a3823c3 100644 --- a/arch/blackfin/include/asm/atomic.h +++ b/arch/blackfin/include/asm/atomic.h | |||
@@ -28,8 +28,6 @@ asmlinkage int __raw_atomic_test_asm(const volatile int *ptr, int value); | |||
28 | #define atomic_add_return(i, v) __raw_atomic_add_asm(&(v)->counter, i) | 28 | #define atomic_add_return(i, v) __raw_atomic_add_asm(&(v)->counter, i) |
29 | #define atomic_sub_return(i, v) __raw_atomic_add_asm(&(v)->counter, -(i)) | 29 | #define atomic_sub_return(i, v) __raw_atomic_add_asm(&(v)->counter, -(i)) |
30 | 30 | ||
31 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
32 | |||
33 | #define atomic_or(i, v) (void)__raw_atomic_or_asm(&(v)->counter, i) | 31 | #define atomic_or(i, v) (void)__raw_atomic_or_asm(&(v)->counter, i) |
34 | #define atomic_and(i, v) (void)__raw_atomic_and_asm(&(v)->counter, i) | 32 | #define atomic_and(i, v) (void)__raw_atomic_and_asm(&(v)->counter, i) |
35 | #define atomic_xor(i, v) (void)__raw_atomic_xor_asm(&(v)->counter, i) | 33 | #define atomic_xor(i, v) (void)__raw_atomic_xor_asm(&(v)->counter, i) |
diff --git a/arch/frv/include/asm/atomic.h b/arch/frv/include/asm/atomic.h index 74d22454d7c6..fc48bea26b40 100644 --- a/arch/frv/include/asm/atomic.h +++ b/arch/frv/include/asm/atomic.h | |||
@@ -192,8 +192,6 @@ static inline void atomic64_##op(long long i, atomic64_t *v) \ | |||
192 | (void)__atomic64_fetch_##op(i, &v->counter); \ | 192 | (void)__atomic64_fetch_##op(i, &v->counter); \ |
193 | } | 193 | } |
194 | 194 | ||
195 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
196 | |||
197 | ATOMIC_OP(or) | 195 | ATOMIC_OP(or) |
198 | ATOMIC_OP(and) | 196 | ATOMIC_OP(and) |
199 | ATOMIC_OP(xor) | 197 | ATOMIC_OP(xor) |
diff --git a/arch/h8300/include/asm/atomic.h b/arch/h8300/include/asm/atomic.h index f181f820be33..c4d061f09c44 100644 --- a/arch/h8300/include/asm/atomic.h +++ b/arch/h8300/include/asm/atomic.h | |||
@@ -41,8 +41,6 @@ static inline void atomic_##op(int i, atomic_t *v) \ | |||
41 | ATOMIC_OP_RETURN(add, +=) | 41 | ATOMIC_OP_RETURN(add, +=) |
42 | ATOMIC_OP_RETURN(sub, -=) | 42 | ATOMIC_OP_RETURN(sub, -=) |
43 | 43 | ||
44 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
45 | |||
46 | ATOMIC_OP(and, &=) | 44 | ATOMIC_OP(and, &=) |
47 | ATOMIC_OP(or, |=) | 45 | ATOMIC_OP(or, |=) |
48 | ATOMIC_OP(xor, ^=) | 46 | ATOMIC_OP(xor, ^=) |
diff --git a/arch/hexagon/include/asm/atomic.h b/arch/hexagon/include/asm/atomic.h index 4efe2c7c0dd8..811d61f6422d 100644 --- a/arch/hexagon/include/asm/atomic.h +++ b/arch/hexagon/include/asm/atomic.h | |||
@@ -132,8 +132,6 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ | |||
132 | ATOMIC_OPS(add) | 132 | ATOMIC_OPS(add) |
133 | ATOMIC_OPS(sub) | 133 | ATOMIC_OPS(sub) |
134 | 134 | ||
135 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
136 | |||
137 | ATOMIC_OP(and) | 135 | ATOMIC_OP(and) |
138 | ATOMIC_OP(or) | 136 | ATOMIC_OP(or) |
139 | ATOMIC_OP(xor) | 137 | ATOMIC_OP(xor) |
diff --git a/arch/ia64/include/asm/atomic.h b/arch/ia64/include/asm/atomic.h index 0809ef5d6b9a..be4beeb77d57 100644 --- a/arch/ia64/include/asm/atomic.h +++ b/arch/ia64/include/asm/atomic.h | |||
@@ -69,8 +69,6 @@ ATOMIC_OP(sub, -) | |||
69 | : ia64_atomic_sub(__ia64_asr_i, v); \ | 69 | : ia64_atomic_sub(__ia64_asr_i, v); \ |
70 | }) | 70 | }) |
71 | 71 | ||
72 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
73 | |||
74 | ATOMIC_OP(and, &) | 72 | ATOMIC_OP(and, &) |
75 | ATOMIC_OP(or, |) | 73 | ATOMIC_OP(or, |) |
76 | ATOMIC_OP(xor, ^) | 74 | ATOMIC_OP(xor, ^) |
diff --git a/arch/m32r/include/asm/atomic.h b/arch/m32r/include/asm/atomic.h index 7245463c1e98..b2a13fbd5be0 100644 --- a/arch/m32r/include/asm/atomic.h +++ b/arch/m32r/include/asm/atomic.h | |||
@@ -94,8 +94,6 @@ static __inline__ int atomic_##op##_return(int i, atomic_t *v) \ | |||
94 | ATOMIC_OPS(add) | 94 | ATOMIC_OPS(add) |
95 | ATOMIC_OPS(sub) | 95 | ATOMIC_OPS(sub) |
96 | 96 | ||
97 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
98 | |||
99 | ATOMIC_OP(and) | 97 | ATOMIC_OP(and) |
100 | ATOMIC_OP(or) | 98 | ATOMIC_OP(or) |
101 | ATOMIC_OP(xor) | 99 | ATOMIC_OP(xor) |
diff --git a/arch/m68k/include/asm/atomic.h b/arch/m68k/include/asm/atomic.h index c30e43ea49a3..93ebd96aa494 100644 --- a/arch/m68k/include/asm/atomic.h +++ b/arch/m68k/include/asm/atomic.h | |||
@@ -77,8 +77,6 @@ static inline int atomic_##op##_return(int i, atomic_t * v) \ | |||
77 | ATOMIC_OPS(add, +=, add) | 77 | ATOMIC_OPS(add, +=, add) |
78 | ATOMIC_OPS(sub, -=, sub) | 78 | ATOMIC_OPS(sub, -=, sub) |
79 | 79 | ||
80 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
81 | |||
82 | ATOMIC_OP(and, &=, and) | 80 | ATOMIC_OP(and, &=, and) |
83 | ATOMIC_OP(or, |=, or) | 81 | ATOMIC_OP(or, |=, or) |
84 | ATOMIC_OP(xor, ^=, eor) | 82 | ATOMIC_OP(xor, ^=, eor) |
diff --git a/arch/metag/include/asm/atomic_lnkget.h b/arch/metag/include/asm/atomic_lnkget.h index 930c12cb8d37..0642606de901 100644 --- a/arch/metag/include/asm/atomic_lnkget.h +++ b/arch/metag/include/asm/atomic_lnkget.h | |||
@@ -74,8 +74,6 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ | |||
74 | ATOMIC_OPS(add) | 74 | ATOMIC_OPS(add) |
75 | ATOMIC_OPS(sub) | 75 | ATOMIC_OPS(sub) |
76 | 76 | ||
77 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
78 | |||
79 | ATOMIC_OP(and) | 77 | ATOMIC_OP(and) |
80 | ATOMIC_OP(or) | 78 | ATOMIC_OP(or) |
81 | ATOMIC_OP(xor) | 79 | ATOMIC_OP(xor) |
diff --git a/arch/mips/include/asm/atomic.h b/arch/mips/include/asm/atomic.h index 0430ba6ab762..4c42fd9af777 100644 --- a/arch/mips/include/asm/atomic.h +++ b/arch/mips/include/asm/atomic.h | |||
@@ -137,8 +137,6 @@ static __inline__ int atomic_##op##_return(int i, atomic_t * v) \ | |||
137 | ATOMIC_OPS(add, +=, addu) | 137 | ATOMIC_OPS(add, +=, addu) |
138 | ATOMIC_OPS(sub, -=, subu) | 138 | ATOMIC_OPS(sub, -=, subu) |
139 | 139 | ||
140 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
141 | |||
142 | ATOMIC_OP(and, &=, and) | 140 | ATOMIC_OP(and, &=, and) |
143 | ATOMIC_OP(or, |=, or) | 141 | ATOMIC_OP(or, |=, or) |
144 | ATOMIC_OP(xor, ^=, xor) | 142 | ATOMIC_OP(xor, ^=, xor) |
diff --git a/arch/mn10300/include/asm/atomic.h b/arch/mn10300/include/asm/atomic.h index 03eea8158cf9..f5a63f0bda46 100644 --- a/arch/mn10300/include/asm/atomic.h +++ b/arch/mn10300/include/asm/atomic.h | |||
@@ -89,8 +89,6 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ | |||
89 | ATOMIC_OPS(add) | 89 | ATOMIC_OPS(add) |
90 | ATOMIC_OPS(sub) | 90 | ATOMIC_OPS(sub) |
91 | 91 | ||
92 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
93 | |||
94 | ATOMIC_OP(and) | 92 | ATOMIC_OP(and) |
95 | ATOMIC_OP(or) | 93 | ATOMIC_OP(or) |
96 | ATOMIC_OP(xor) | 94 | ATOMIC_OP(xor) |
diff --git a/arch/parisc/include/asm/atomic.h b/arch/parisc/include/asm/atomic.h index be2c50ddebd6..2536965d00ea 100644 --- a/arch/parisc/include/asm/atomic.h +++ b/arch/parisc/include/asm/atomic.h | |||
@@ -126,8 +126,6 @@ static __inline__ int atomic_##op##_return(int i, atomic_t *v) \ | |||
126 | ATOMIC_OPS(add, +=) | 126 | ATOMIC_OPS(add, +=) |
127 | ATOMIC_OPS(sub, -=) | 127 | ATOMIC_OPS(sub, -=) |
128 | 128 | ||
129 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
130 | |||
131 | ATOMIC_OP(and, &=) | 129 | ATOMIC_OP(and, &=) |
132 | ATOMIC_OP(or, |=) | 130 | ATOMIC_OP(or, |=) |
133 | ATOMIC_OP(xor, ^=) | 131 | ATOMIC_OP(xor, ^=) |
diff --git a/arch/powerpc/include/asm/atomic.h b/arch/powerpc/include/asm/atomic.h index 6ca89e2aca15..55f106ed12bf 100644 --- a/arch/powerpc/include/asm/atomic.h +++ b/arch/powerpc/include/asm/atomic.h | |||
@@ -67,8 +67,6 @@ static __inline__ int atomic_##op##_return(int a, atomic_t *v) \ | |||
67 | ATOMIC_OPS(add, add) | 67 | ATOMIC_OPS(add, add) |
68 | ATOMIC_OPS(sub, subf) | 68 | ATOMIC_OPS(sub, subf) |
69 | 69 | ||
70 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
71 | |||
72 | ATOMIC_OP(and, and) | 70 | ATOMIC_OP(and, and) |
73 | ATOMIC_OP(or, or) | 71 | ATOMIC_OP(or, or) |
74 | ATOMIC_OP(xor, xor) | 72 | ATOMIC_OP(xor, xor) |
diff --git a/arch/s390/include/asm/atomic.h b/arch/s390/include/asm/atomic.h index b3859d8e001f..d761aeff72da 100644 --- a/arch/s390/include/asm/atomic.h +++ b/arch/s390/include/asm/atomic.h | |||
@@ -282,8 +282,6 @@ static inline void atomic64_##op(long i, atomic64_t *v) \ | |||
282 | __ATOMIC64_LOOP(v, i, __ATOMIC64_##OP, __ATOMIC64_NO_BARRIER); \ | 282 | __ATOMIC64_LOOP(v, i, __ATOMIC64_##OP, __ATOMIC64_NO_BARRIER); \ |
283 | } | 283 | } |
284 | 284 | ||
285 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
286 | |||
287 | ATOMIC64_OP(and, AND) | 285 | ATOMIC64_OP(and, AND) |
288 | ATOMIC64_OP(or, OR) | 286 | ATOMIC64_OP(or, OR) |
289 | ATOMIC64_OP(xor, XOR) | 287 | ATOMIC64_OP(xor, XOR) |
diff --git a/arch/sh/include/asm/atomic-grb.h b/arch/sh/include/asm/atomic-grb.h index 4b03830d48c7..b94df40e5f2d 100644 --- a/arch/sh/include/asm/atomic-grb.h +++ b/arch/sh/include/asm/atomic-grb.h | |||
@@ -48,8 +48,6 @@ static inline int atomic_##op##_return(int i, atomic_t *v) \ | |||
48 | ATOMIC_OPS(add) | 48 | ATOMIC_OPS(add) |
49 | ATOMIC_OPS(sub) | 49 | ATOMIC_OPS(sub) |
50 | 50 | ||
51 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
52 | |||
53 | ATOMIC_OP(and) | 51 | ATOMIC_OP(and) |
54 | ATOMIC_OP(or) | 52 | ATOMIC_OP(or) |
55 | ATOMIC_OP(xor) | 53 | ATOMIC_OP(xor) |
diff --git a/arch/sparc/include/asm/atomic_32.h b/arch/sparc/include/asm/atomic_32.h index e19d8880b146..7dcbebbcaec6 100644 --- a/arch/sparc/include/asm/atomic_32.h +++ b/arch/sparc/include/asm/atomic_32.h | |||
@@ -17,8 +17,6 @@ | |||
17 | #include <asm/barrier.h> | 17 | #include <asm/barrier.h> |
18 | #include <asm-generic/atomic64.h> | 18 | #include <asm-generic/atomic64.h> |
19 | 19 | ||
20 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
21 | |||
22 | #define ATOMIC_INIT(i) { (i) } | 20 | #define ATOMIC_INIT(i) { (i) } |
23 | 21 | ||
24 | int atomic_add_return(int, atomic_t *); | 22 | int atomic_add_return(int, atomic_t *); |
diff --git a/arch/sparc/include/asm/atomic_64.h b/arch/sparc/include/asm/atomic_64.h index d6af27c93450..917084ace49d 100644 --- a/arch/sparc/include/asm/atomic_64.h +++ b/arch/sparc/include/asm/atomic_64.h | |||
@@ -33,8 +33,6 @@ long atomic64_##op##_return(long, atomic64_t *); | |||
33 | ATOMIC_OPS(add) | 33 | ATOMIC_OPS(add) |
34 | ATOMIC_OPS(sub) | 34 | ATOMIC_OPS(sub) |
35 | 35 | ||
36 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
37 | |||
38 | ATOMIC_OP(and) | 36 | ATOMIC_OP(and) |
39 | ATOMIC_OP(or) | 37 | ATOMIC_OP(or) |
40 | ATOMIC_OP(xor) | 38 | ATOMIC_OP(xor) |
diff --git a/arch/tile/include/asm/atomic_32.h b/arch/tile/include/asm/atomic_32.h index 94237922f0dd..d320ce253d86 100644 --- a/arch/tile/include/asm/atomic_32.h +++ b/arch/tile/include/asm/atomic_32.h | |||
@@ -41,8 +41,6 @@ static inline void atomic_##op(int i, atomic_t *v) \ | |||
41 | _atomic_##op((unsigned long *)&v->counter, i); \ | 41 | _atomic_##op((unsigned long *)&v->counter, i); \ |
42 | } | 42 | } |
43 | 43 | ||
44 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
45 | |||
46 | ATOMIC_OP(and) | 44 | ATOMIC_OP(and) |
47 | ATOMIC_OP(or) | 45 | ATOMIC_OP(or) |
48 | ATOMIC_OP(xor) | 46 | ATOMIC_OP(xor) |
diff --git a/arch/tile/include/asm/atomic_64.h b/arch/tile/include/asm/atomic_64.h index d07d9fc6e2a1..096a56d6ead4 100644 --- a/arch/tile/include/asm/atomic_64.h +++ b/arch/tile/include/asm/atomic_64.h | |||
@@ -58,8 +58,6 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) | |||
58 | return oldval; | 58 | return oldval; |
59 | } | 59 | } |
60 | 60 | ||
61 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
62 | |||
63 | static inline void atomic_and(int i, atomic_t *v) | 61 | static inline void atomic_and(int i, atomic_t *v) |
64 | { | 62 | { |
65 | __insn_fetchand4((void *)&v->counter, i); | 63 | __insn_fetchand4((void *)&v->counter, i); |
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h index f3a3ec040694..b3493023efda 100644 --- a/arch/x86/include/asm/atomic.h +++ b/arch/x86/include/asm/atomic.h | |||
@@ -191,8 +191,6 @@ static inline void atomic_##op(int i, atomic_t *v) \ | |||
191 | : "memory"); \ | 191 | : "memory"); \ |
192 | } | 192 | } |
193 | 193 | ||
194 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
195 | |||
196 | ATOMIC_OP(and) | 194 | ATOMIC_OP(and) |
197 | ATOMIC_OP(or) | 195 | ATOMIC_OP(or) |
198 | ATOMIC_OP(xor) | 196 | ATOMIC_OP(xor) |
diff --git a/arch/xtensa/include/asm/atomic.h b/arch/xtensa/include/asm/atomic.h index 4dd2450300a6..31371f43c23b 100644 --- a/arch/xtensa/include/asm/atomic.h +++ b/arch/xtensa/include/asm/atomic.h | |||
@@ -145,8 +145,6 @@ static inline int atomic_##op##_return(int i, atomic_t * v) \ | |||
145 | ATOMIC_OPS(add) | 145 | ATOMIC_OPS(add) |
146 | ATOMIC_OPS(sub) | 146 | ATOMIC_OPS(sub) |
147 | 147 | ||
148 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
149 | |||
150 | ATOMIC_OP(and) | 148 | ATOMIC_OP(and) |
151 | ATOMIC_OP(or) | 149 | ATOMIC_OP(or) |
152 | ATOMIC_OP(xor) | 150 | ATOMIC_OP(xor) |
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h index 92947e0a532a..a41b0b8f7404 100644 --- a/include/asm-generic/atomic.h +++ b/include/asm-generic/atomic.h | |||
@@ -102,24 +102,27 @@ ATOMIC_OP_RETURN(sub, -) | |||
102 | ATOMIC_OP(and, &) | 102 | ATOMIC_OP(and, &) |
103 | #endif | 103 | #endif |
104 | 104 | ||
105 | #ifndef atomic_clear_mask | ||
106 | #define atomic_clear_mask(i, v) atomic_and(~(i), (v)) | ||
107 | #endif | ||
108 | |||
109 | #ifndef atomic_or | 105 | #ifndef atomic_or |
110 | #ifndef CONFIG_ARCH_HAS_ATOMIC_OR | ||
111 | #define CONFIG_ARCH_HAS_ATOMIC_OR | ||
112 | #endif | ||
113 | ATOMIC_OP(or, |) | 106 | ATOMIC_OP(or, |) |
114 | #endif | 107 | #endif |
115 | 108 | ||
116 | #ifndef atomic_set_mask | 109 | #ifndef atomic_xor |
117 | #define atomic_set_mask(i, v) atomic_or((i), (v)) | 110 | ATOMIC_OP(xor, ^) |
118 | #endif | 111 | #endif |
119 | 112 | ||
120 | #undef ATOMIC_OP_RETURN | 113 | #undef ATOMIC_OP_RETURN |
121 | #undef ATOMIC_OP | 114 | #undef ATOMIC_OP |
122 | 115 | ||
116 | static inline __deprecated void atomic_clear_mask(unsigned int mask, atomic_t *v) | ||
117 | { | ||
118 | atomic_and(~mask, v); | ||
119 | } | ||
120 | |||
121 | static inline __deprecated void atomic_set_mask(unsigned int mask, atomic_t *v) | ||
122 | { | ||
123 | atomic_or(mask, v); | ||
124 | } | ||
125 | |||
123 | /* | 126 | /* |
124 | * Atomic operations that C can't guarantee us. Useful for | 127 | * Atomic operations that C can't guarantee us. Useful for |
125 | * resource counting etc.. | 128 | * resource counting etc.. |
diff --git a/include/asm-generic/atomic64.h b/include/asm-generic/atomic64.h index 30ad9c86cebb..d48e78ccad3d 100644 --- a/include/asm-generic/atomic64.h +++ b/include/asm-generic/atomic64.h | |||
@@ -32,6 +32,10 @@ extern long long atomic64_##op##_return(long long a, atomic64_t *v); | |||
32 | ATOMIC64_OPS(add) | 32 | ATOMIC64_OPS(add) |
33 | ATOMIC64_OPS(sub) | 33 | ATOMIC64_OPS(sub) |
34 | 34 | ||
35 | ATOMIC64_OP(and) | ||
36 | ATOMIC64_OP(or) | ||
37 | ATOMIC64_OP(xor) | ||
38 | |||
35 | #undef ATOMIC64_OPS | 39 | #undef ATOMIC64_OPS |
36 | #undef ATOMIC64_OP_RETURN | 40 | #undef ATOMIC64_OP_RETURN |
37 | #undef ATOMIC64_OP | 41 | #undef ATOMIC64_OP |
diff --git a/include/linux/atomic.h b/include/linux/atomic.h index 5b08a8540ecf..7d6279012a1f 100644 --- a/include/linux/atomic.h +++ b/include/linux/atomic.h | |||
@@ -111,19 +111,6 @@ static inline int atomic_dec_if_positive(atomic_t *v) | |||
111 | } | 111 | } |
112 | #endif | 112 | #endif |
113 | 113 | ||
114 | #ifndef CONFIG_ARCH_HAS_ATOMIC_OR | ||
115 | static inline void atomic_or(int i, atomic_t *v) | ||
116 | { | ||
117 | int old; | ||
118 | int new; | ||
119 | |||
120 | do { | ||
121 | old = atomic_read(v); | ||
122 | new = old | i; | ||
123 | } while (atomic_cmpxchg(v, old, new) != old); | ||
124 | } | ||
125 | #endif /* #ifndef CONFIG_ARCH_HAS_ATOMIC_OR */ | ||
126 | |||
127 | #include <asm-generic/atomic-long.h> | 114 | #include <asm-generic/atomic-long.h> |
128 | #ifdef CONFIG_GENERIC_ATOMIC64 | 115 | #ifdef CONFIG_GENERIC_ATOMIC64 |
129 | #include <asm-generic/atomic64.h> | 116 | #include <asm-generic/atomic64.h> |
diff --git a/lib/atomic64.c b/lib/atomic64.c index 1298c05ef528..2886ebac6567 100644 --- a/lib/atomic64.c +++ b/lib/atomic64.c | |||
@@ -102,6 +102,9 @@ EXPORT_SYMBOL(atomic64_##op##_return); | |||
102 | 102 | ||
103 | ATOMIC64_OPS(add, +=) | 103 | ATOMIC64_OPS(add, +=) |
104 | ATOMIC64_OPS(sub, -=) | 104 | ATOMIC64_OPS(sub, -=) |
105 | ATOMIC64_OP(and, &=) | ||
106 | ATOMIC64_OP(or, |=) | ||
107 | ATOMIC64_OP(xor, ^=) | ||
105 | 108 | ||
106 | #undef ATOMIC64_OPS | 109 | #undef ATOMIC64_OPS |
107 | #undef ATOMIC64_OP_RETURN | 110 | #undef ATOMIC64_OP_RETURN |