path: root/arch/xtensa/include/asm/atomic.h
diff options
authorPeter Zijlstra <>2015-09-18 11:13:10 +0200
committerIngo Molnar <>2015-09-23 09:54:28 +0200
commit62e8a3258bda118f24ff462fe04cfbe75b8189b5 (patch)
tree79edd4b96f8c3495435be8b148127d5738d1db63 /arch/xtensa/include/asm/atomic.h
parent90fe65148ea76988d8d5acbf3e578aa74129a490 (diff)
atomic, arch: Audit atomic_{read,set}()
This patch makes sure that atomic_{read,set}() are at least {READ,WRITE}_ONCE(). We already had the 'requirement' that atomic_read() should use ACCESS_ONCE(), and most archs had this, but a few were lacking. All are now converted to use READ_ONCE(). And, by a symmetry and general paranoia argument, upgrade atomic_set() to use WRITE_ONCE(). Signed-off-by: Peter Zijlstra (Intel) <> Cc: Andrew Morton <> Cc: Dmitry Vyukov <> Cc: Linus Torvalds <> Cc: Paul E. McKenney <> Cc: Peter Zijlstra <> Cc: Thomas Gleixner <> Cc: Cc: Cc: Cc: Signed-off-by: Ingo Molnar <>
Diffstat (limited to 'arch/xtensa/include/asm/atomic.h')
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/xtensa/include/asm/atomic.h b/arch/xtensa/include/asm/atomic.h
index 93795d047303..fd8017ce298a 100644
--- a/arch/xtensa/include/asm/atomic.h
+++ b/arch/xtensa/include/asm/atomic.h
@@ -47,7 +47,7 @@
* Atomically reads the value of @v.
-#define atomic_read(v) ACCESS_ONCE((v)->counter)
+#define atomic_read(v) READ_ONCE((v)->counter)
* atomic_set - set atomic variable
@@ -56,7 +56,7 @@
* Atomically sets the value of @v to @i.
-#define atomic_set(v,i) ((v)->counter = (i))
+#define atomic_set(v,i) WRITE_ONCE((v)->counter, (i))
#define ATOMIC_OP(op) \