diff options
author | Peter Zijlstra <peterz@infradead.org> | 2015-07-15 09:47:25 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-07-27 08:06:21 -0400 |
commit | 56d1defe0bbddaa97d6e74b51490904130fd4f1d (patch) | |
tree | 59a3495e8bd5b2c4b9388d64bcfd06ee6b5e58b8 | |
parent | cbfe8fa6cd672011c755c3cd85c9ffd4e2d10a6f (diff) |
atomic: Prepare generic atomic implementation for logic ops
Clean up the #ifdef guards a bit to prepare for architectures to
supply their own logic ops.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r-- | include/asm-generic/atomic.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/include/asm-generic/atomic.h b/include/asm-generic/atomic.h index 1973ad2b13f4..92947e0a532a 100644 --- a/include/asm-generic/atomic.h +++ b/include/asm-generic/atomic.h | |||
@@ -98,14 +98,22 @@ ATOMIC_OP_RETURN(add, +) | |||
98 | ATOMIC_OP_RETURN(sub, -) | 98 | ATOMIC_OP_RETURN(sub, -) |
99 | #endif | 99 | #endif |
100 | 100 | ||
101 | #ifndef atomic_clear_mask | 101 | #ifndef atomic_and |
102 | ATOMIC_OP(and, &) | 102 | ATOMIC_OP(and, &) |
103 | #endif | ||
104 | |||
105 | #ifndef atomic_clear_mask | ||
103 | #define atomic_clear_mask(i, v) atomic_and(~(i), (v)) | 106 | #define atomic_clear_mask(i, v) atomic_and(~(i), (v)) |
104 | #endif | 107 | #endif |
105 | 108 | ||
106 | #ifndef atomic_set_mask | 109 | #ifndef atomic_or |
110 | #ifndef CONFIG_ARCH_HAS_ATOMIC_OR | ||
107 | #define CONFIG_ARCH_HAS_ATOMIC_OR | 111 | #define CONFIG_ARCH_HAS_ATOMIC_OR |
112 | #endif | ||
108 | ATOMIC_OP(or, |) | 113 | ATOMIC_OP(or, |) |
114 | #endif | ||
115 | |||
116 | #ifndef atomic_set_mask | ||
109 | #define atomic_set_mask(i, v) atomic_or((i), (v)) | 117 | #define atomic_set_mask(i, v) atomic_or((i), (v)) |
110 | #endif | 118 | #endif |
111 | 119 | ||