diff options
author | Pranith Kumar <bobby.prani@gmail.com> | 2014-09-23 10:29:50 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2014-10-03 00:06:23 -0400 |
commit | 2291059c852706c6f5ffb400366042b7625066cd (patch) | |
tree | 7827b5e7992bc0d3533d5832773c6be2f4221782 /arch/arm64 | |
parent | da4c54457e6d8262423aded4bcbccc4103049506 (diff) |
locking,arch: Use ACCESS_ONCE() instead of cast to volatile in atomic_read()
Use the much more reader friendly ACCESS_ONCE() instead of the cast to volatile.
This is purely a stylistic change.
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com>
Acked-by: Jesper Nilsson <jesper.nilsson@axis.com>
Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-arch@vger.kernel.org
Link: http://lkml.kernel.org/r/1411482607-20948-1-git-send-email-bobby.prani@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/arm64')
-rw-r--r-- | arch/arm64/include/asm/atomic.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm64/include/asm/atomic.h b/arch/arm64/include/asm/atomic.h index b83c325e587f..7047051ded40 100644 --- a/arch/arm64/include/asm/atomic.h +++ b/arch/arm64/include/asm/atomic.h | |||
@@ -35,7 +35,7 @@ | |||
35 | * strex/ldrex monitor on some implementations. The reason we can use it for | 35 | * strex/ldrex monitor on some implementations. The reason we can use it for |
36 | * atomic_set() is the clrex or dummy strex done on every exception return. | 36 | * atomic_set() is the clrex or dummy strex done on every exception return. |
37 | */ | 37 | */ |
38 | #define atomic_read(v) (*(volatile int *)&(v)->counter) | 38 | #define atomic_read(v) ACCESS_ONCE((v)->counter) |
39 | #define atomic_set(v,i) (((v)->counter) = (i)) | 39 | #define atomic_set(v,i) (((v)->counter) = (i)) |
40 | 40 | ||
41 | /* | 41 | /* |
@@ -139,7 +139,7 @@ static inline int __atomic_add_unless(atomic_t *v, int a, int u) | |||
139 | */ | 139 | */ |
140 | #define ATOMIC64_INIT(i) { (i) } | 140 | #define ATOMIC64_INIT(i) { (i) } |
141 | 141 | ||
142 | #define atomic64_read(v) (*(volatile long *)&(v)->counter) | 142 | #define atomic64_read(v) ACCESS_ONCE((v)->counter) |
143 | #define atomic64_set(v,i) (((v)->counter) = (i)) | 143 | #define atomic64_set(v,i) (((v)->counter) = (i)) |
144 | 144 | ||
145 | #define ATOMIC64_OP(op, asm_op) \ | 145 | #define ATOMIC64_OP(op, asm_op) \ |