Skip to content

Commit 2a22f69

Browse files
mrutland-armingomolnar
authored andcommitted
tools/include: Remove ACCESS_ONCE()
There are no longer any usersapce uses of ACCESS_ONCE(), so we can remove the definition from our userspace <linux/compiler.h>, which is only used by tools in the kernel directory (i.e. it isn't a uapi header). This patch removes the ACCESS_ONCE() definition, and updates comments which referred to it. At the same time, some inconsistent and redundant whitespace is removed from comments. Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Signed-off-by: Mark Rutland <mark.rutland@arm.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Joe Perches <joe@perches.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: apw@canonical.com Link: http://lkml.kernel.org/r/20171127103824.36526-3-mark.rutland@arm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent f971e51 commit 2a22f69

1 file changed

Lines changed: 9 additions & 12 deletions

File tree

‎tools/include/linux/compiler.h‎

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,6 @@
8484

8585
#define uninitialized_var(x) x = *(&(x))
8686

87-
#define ACCESS_ONCE(x) (*(volatile typeof(x) *)&(x))
88-
8987
#include <linux/types.h>
9088

9189
/*
@@ -135,20 +133,19 @@ static __always_inline void __write_once_size(volatile void *p, void *res, int s
135133
/*
136134
* Prevent the compiler from merging or refetching reads or writes. The
137135
* compiler is also forbidden from reordering successive instances of
138-
* READ_ONCE, WRITE_ONCE and ACCESS_ONCE (see below), but only when the
139-
* compiler is aware of some particular ordering. One way to make the
140-
* compiler aware of ordering is to put the two invocations of READ_ONCE,
141-
* WRITE_ONCE or ACCESS_ONCE() in different C statements.
136+
* READ_ONCE and WRITE_ONCE, but only when the compiler is aware of some
137+
* particular ordering. One way to make the compiler aware of ordering is to
138+
* put the two invocations of READ_ONCE or WRITE_ONCE in different C
139+
* statements.
142140
*
143-
* In contrast to ACCESS_ONCE these two macros will also work on aggregate
144-
* data types like structs or unions. If the size of the accessed data
145-
* type exceeds the word size of the machine (e.g., 32 bits or 64 bits)
146-
* READ_ONCE() and WRITE_ONCE() will fall back to memcpy and print a
147-
* compile-time warning.
141+
* These two macros will also work on aggregate data types like structs or
142+
* unions. If the size of the accessed data type exceeds the word size of
143+
* the machine (e.g., 32 bits or 64 bits) READ_ONCE() and WRITE_ONCE() will
144+
* fall back to memcpy and print a compile-time warning.
148145
*
149146
* Their two major use cases are: (1) Mediating communication between
150147
* process-level code and irq/NMI handlers, all running on the same CPU,
151-
* and (2) Ensuring that the compiler does not fold, spindle, or otherwise
148+
* and (2) Ensuring that the compiler does not fold, spindle, or otherwise
152149
* mutilate accesses that either do not require ordering or that interact
153150
* with an explicit memory barrier or atomic instruction that provides the
154151
* required ordering.

0 commit comments

Comments
 (0)