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< | |||
