aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael S. Tsirkin <mst@redhat.com>2015-12-27 07:10:52 -0500
committerMichael S. Tsirkin <mst@redhat.com>2016-01-12 13:46:46 -0500
commit57f7c0370f386d5e0960e25d2c3ceb0b8e8c489d (patch)
tree67ca06dd81773d44151edf8a0b6a56d29bedef6a
parent5a1b26d7c629915446222ebe77d16567c98426ff (diff)
asm-generic: guard smp_store_release/load_acquire
Allow architectures to override smp_store_release and smp_load_acquire by guarding the defines in asm-generic/barrier.h with ifndef directives. This is in preparation to reusing asm-generic/barrier.h on architectures which have their own definition of these macros. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
-rw-r--r--include/asm-generic/barrier.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/asm-generic/barrier.h b/include/asm-generic/barrier.h
index 0f45f93ef692..987b2e04ad5a 100644
--- a/include/asm-generic/barrier.h
+++ b/include/asm-generic/barrier.h
@@ -104,13 +104,16 @@
104#define smp_mb__after_atomic() smp_mb() 104#define smp_mb__after_atomic() smp_mb()
105#endif 105#endif
106 106
107#ifndef smp_store_release
107#define smp_store_release(p, v) \ 108#define smp_store_release(p, v) \
108do { \ 109do { \
109 compiletime_assert_atomic_type(*p); \ 110 compiletime_assert_atomic_type(*p); \
110 smp_mb(); \ 111 smp_mb(); \
111 WRITE_ONCE(*p, v); \ 112 WRITE_ONCE(*p, v); \
112} while (0) 113} while (0)
114#endif
113 115
116#ifndef smp_load_acquire
114#define smp_load_acquire(p) \ 117#define smp_load_acquire(p) \
115({ \ 118({ \
116 typeof(*p) ___p1 = READ_ONCE(*p); \ 119 typeof(*p) ___p1 = READ_ONCE(*p); \
@@ -118,6 +121,7 @@ do { \
118 smp_mb(); \ 121 smp_mb(); \
119 ___p1; \ 122 ___p1; \
120}) 123})
124#endif
121 125
122#endif /* !__ASSEMBLY__ */ 126#endif /* !__ASSEMBLY__ */
123#endif /* __ASM_GENERIC_BARRIER_H */ 127#endif /* __ASM_GENERIC_BARRIER_H */