summaryrefslogtreecommitdiffstats
path: root/include/asm-generic
diff options
context:
space:
mode:
authorVineet Gupta <vgupta@synopsys.com>2015-03-11 17:12:02 +0100
committerVineet Gupta <vgupta@synopsys.com>2015-06-25 02:30:17 +0200
commit470c27e4695add2a4e167467775081870d83185a (patch)
tree49e14d2e7ec8dcdf2884589614783d6421c29665 /include/asm-generic
parentARC: add smp barriers around atomics per Documentation/atomic_ops.txt (diff)
downloadlinux-470c27e4695add2a4e167467775081870d83185a.tar.xz
linux-470c27e4695add2a4e167467775081870d83185a.zip
arch: conditionally define smp_{mb,rmb,wmb}
That way arches can define the minimal versions and still #include asm-generic for defaults (vs. defining defaults in arch code) See new barrier.h in arc for usage ! Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
Diffstat (limited to 'include/asm-generic')
-rw-r--r--include/asm-generic/barrier.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h
index f5c40b0fadc2..270b7c989ea1 100644
--- a/include/asm-generic/barrier.h
+++ b/include/asm-generic/barrier.h
@@ -55,17 +55,42 @@
#endif
#ifdef CONFIG_SMP
+
+#ifndef smp_mb
#define smp_mb() mb()
+#endif
+
+#ifndef smp_rmb
#define smp_rmb() rmb()
+#endif
+
+#ifndef smp_wmb
#define smp_wmb() wmb()
+#endif
+
+#ifndef smp_read_barrier_depends
#define smp_read_barrier_depends() read_barrier_depends()
+#endif
+
#else
+#ifndef smp_mb
#define smp_mb() barrier()
+#endif
+
+#ifndef smp_rmb
#define smp_rmb() barrier()
+#endif
+
+#ifndef smp_wmb
#define smp_wmb() barrier()
+#endif
+
+#ifndef smp_read_barrier_depends
#define smp_read_barrier_depends() do { } while (0)
#endif
+#endif
+
#ifndef set_mb
#define set_mb(var, value) do { (var) = (value); mb(); } while (0)
#endif