summaryrefslogtreecommitdiff
path: root/include/asm-generic
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2015-07-15 16:47:25 +0300
committerThomas Gleixner <tglx@linutronix.de>2015-07-27 15:06:21 +0300
commit56d1defe0bbddaa97d6e74b51490904130fd4f1d (patch)
tree59a3495e8bd5b2c4b9388d64bcfd06ee6b5e58b8 /include/asm-generic
parentcbfe8fa6cd672011c755c3cd85c9ffd4e2d10a6f (diff)
downloadlinux-56d1defe0bbddaa97d6e74b51490904130fd4f1d.tar.xz
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>
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/atomic.h12
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, +)
ATOMIC_OP_RETURN(sub, -)
#endif
-#ifndef atomic_clear_mask
+#ifndef atomic_and
ATOMIC_OP(and, &)
+#endif
+
+#ifndef atomic_clear_mask
#define atomic_clear_mask(i, v) atomic_and(~(i), (v))
#endif
-#ifndef atomic_set_mask
+#ifndef atomic_or
+#ifndef CONFIG_ARCH_HAS_ATOMIC_OR
#define CONFIG_ARCH_HAS_ATOMIC_OR
+#endif
ATOMIC_OP(or, |)
+#endif
+
+#ifndef atomic_set_mask
#define atomic_set_mask(i, v) atomic_or((i), (v))
#endif