x86: Use ACCESS_ONCE() for atomic_read()
Subsystems (2)
RFC PATCH 1/1 x86: Use ACCESS_ONCE() for atomic_read()
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).
--- arch/x86/include/asm/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/include/asm/atomic.h +1 -1
@@ -24,7 +24,7 @@*/ static inline int atomic_read (const atomic_t *v) { -return (*(volatile int *)&(v)->counter); +return ACCESS_ONCE (v->counter); }/**
Signature · 1 line
2.1.0
Peter Zijlstra
maintainerQuoted 10 lines · Pranith Kumar
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 <[email protected]>--- arch/x86/include/asm/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
If you want to do something like so, then be consistent and do them all.
Quoted 7 lines · Peter Zijlstra
Quoted 6 lines · Pranith Kumar
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).
Quoted 6 lines
Quoted 4 lines
Signed-off-by Pranith Kumar <[email protected]>--- arch/x86/include/asm/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)If you want to do something like so, then be consistent and do them all.
Sure, I will change this in all architectures and send in an updated patch.
Thanks!
Signature · 1 line
Pranith
Quoted 7 lines · Peter Zijlstra
Quoted 6 lines · Pranith Kumar
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).
Quoted 6 lines
Quoted 4 lines
Signed-off-by Pranith Kumar <[email protected]>--- arch/x86/include/asm/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)If you want to do something like so, then be consistent and do them all.
Hi Peter,
The changelog across all archs is as follows
18 files changed, 24 insertions(+), 24 deletions(-)
Do you think it is better to send it as one patch or break up into patch for each arch?
Signature · 1 line
Pranith
Peter Zijlstra
maintainerQuoted 15 lines · Pranith Kumar
Quoted 7 lines · Peter Zijlstra
Quoted 6 lines · Pranith Kumar
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).Quoted 6 lines
Quoted 4 lines
Signed-off-by Pranith Kumar <[email protected]>--- arch/x86/include/asm/atomic.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)If you want to do something like so, then be consistent and do them all.
Quoted 8 lines
Hi Peter,
The changelog across all archs is as follows
18 files changed, 24 insertions(+), 24 deletions(-)Do you think it is better to send it as one patch or break up into patch for each arch?
I'd send it as a single patch, its small enough as is, and basically just a 'style' update.