summaryrefslogtreecommitdiff
path: root/include/asm-generic/rwonce.h
diff options
context:
space:
mode:
authorWill Deacon <will@kernel.org>2019-10-15 17:30:47 -0700
committerWill Deacon <will@kernel.org>2020-07-21 10:50:35 +0100
commitb78b331a3f5c0773171dadd6bbfa2a2242b45604 (patch)
tree6e9a048a1026a379b549760c863e636539e10863 /include/asm-generic/rwonce.h
parente506ea451254ab17e0bf918ca36232fec2a9b10c (diff)
downloadlwn-b78b331a3f5c0773171dadd6bbfa2a2242b45604.tar.gz
lwn-b78b331a3f5c0773171dadd6bbfa2a2242b45604.zip
asm/rwonce: Allow __READ_ONCE to be overridden by the architecture
The meat and potatoes of READ_ONCE() is defined by the __READ_ONCE() macro, which uses a volatile casts in an attempt to avoid tearing of byte, halfword, word and double-word accesses. Allow this to be overridden by the architecture code in the case that things like memory barriers are also required. Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Paul E. McKenney <paulmck@kernel.org> Signed-off-by: Will Deacon <will@kernel.org>
Diffstat (limited to 'include/asm-generic/rwonce.h')
-rw-r--r--include/asm-generic/rwonce.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/asm-generic/rwonce.h b/include/asm-generic/rwonce.h
index 87584379da43..04586b55a7c2 100644
--- a/include/asm-generic/rwonce.h
+++ b/include/asm-generic/rwonce.h
@@ -43,7 +43,9 @@
* atomicity or dependency ordering guarantees. Note that this may result
* in tears!
*/
+#ifndef __READ_ONCE
#define __READ_ONCE(x) (*(const volatile __unqual_scalar_typeof(x) *)&(x))
+#endif
#define __READ_ONCE_SCALAR(x) \
({ \