Messages in this thread Patch in this message | | | From | Pranith Kumar <> | Subject | [RFC PATCH] x86: Use ACCESS_ONCE() for atomic_read() | Date | Mon, 22 Sep 2014 15:53:09 -0400 |
| |
Use the much easier to read ACCESS_ONCE() which is basically the same thing as the cast to volatile.
Please note the change in volatile cast: ACCESS_ONCE(v)->counter to ACCESS_ONCE(v->counter).
Signed-off-by: Pranith Kumar <bobby.prani@gmail.com> --- arch/x86/include/asm/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h index fa92e93..dea3434 100644 --- a/arch/x86/include/asm/atomic.h +++ b/arch/x86/include/asm/atomic.h @@ -24,7 +24,7 @@ */ static inline int atomic_read(const atomic_t *v) { - return (*(volatile int *)&(v)->counter); + return ACCESS_ONCE(v->counter); } /** -- 2.1.0
| |