aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/compiler.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r--include/linux/compiler.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 5d66777914db..05be2352fef8 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -250,7 +250,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
250 ({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) 250 ({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; })
251 251
252#define WRITE_ONCE(x, val) \ 252#define WRITE_ONCE(x, val) \
253 ({ typeof(x) __val = (val); __write_once_size(&(x), &__val, sizeof(__val)); __val; }) 253 ({ union { typeof(x) __val; char __c[1]; } __u = { .__val = (val) }; __write_once_size(&(x), __u.__c, sizeof(x)); __u.__val; })
254 254
255/** 255/**
256 * READ_ONCE_CTRL - Read a value heading a control dependency 256 * READ_ONCE_CTRL - Read a value heading a control dependency
@@ -466,7 +466,7 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
466 * with an explicit memory barrier or atomic instruction that provides the 466 * with an explicit memory barrier or atomic instruction that provides the
467 * required ordering. 467 * required ordering.
468 * 468 *
469 * If possible use READ_ONCE/ASSIGN_ONCE instead. 469 * If possible use READ_ONCE()/WRITE_ONCE() instead.
470 */ 470 */
471#define __ACCESS_ONCE(x) ({ \ 471#define __ACCESS_ONCE(x) ({ \
472 __maybe_unused typeof(x) __var = (__force typeof(x)) 0; \ 472 __maybe_unused typeof(x) __var = (__force typeof(x)) 0; \