summaryrefslogtreecommitdiffstats
path: root/arch/tile
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2017-10-23 17:07:29 -0400
committerIngo Molnar <mingo@kernel.org>2017-10-25 05:01:08 -0400
commit6aa7de059173a986114ac43b8f50b297a86f09a8 (patch)
tree77666afe795e022914ca26433d61686c694dc4fd /arch/tile
parentb03a0fe0c5e4b46dcd400d27395b124499554a71 (diff)
locking/atomics: COCCINELLE/treewide: Convert trivial ACCESS_ONCE() patterns to READ_ONCE()/WRITE_ONCE()
Please do not apply this to mainline directly, instead please re-run the coccinelle script shown below and apply its output. For several reasons, it is desirable to use {READ,WRITE}_ONCE() in preference to ACCESS_ONCE(), and new code is expected to use one of the former. So far, there's been no reason to change most existing uses of ACCESS_ONCE(), as these aren't harmful, and changing them results in churn. However, for some features, the read/write distinction is critical to correct operation. To distinguish these cases, separate read/write accessors must be used. This patch migrates (most) remaining ACCESS_ONCE() instances to {READ,WRITE}_ONCE(), using the following coccinelle script: ---- // Convert trivial ACCESS_ONCE() uses to equivalent READ_ONCE() and // WRITE_ONCE() // $ make coccicheck COCCI=/home/mark/once.cocci SPFLAGS="--include-headers" MODE=patch virtual patch @ depends on patch @ expression E1, E2; @@ - ACCESS_ONCE(E1) = E2 + WRITE_ONCE(E1, E2) @ depends on patch @ expression E; @@ - ACCESS_ONCE(E) + READ_ONCE(E) ---- Signed-off-by: Mark Rutland <mark.rutland@arm.com> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: davem@davemloft.net Cc: linux-arch@vger.kernel.org Cc: mpe@ellerman.id.au Cc: shuah@kernel.org Cc: snitzer@redhat.com Cc: thor.thayer@linux.intel.com Cc: tj@kernel.org Cc: viro@zeniv.linux.org.uk Cc: will.deacon@arm.com Link: http://lkml.kernel.org/r/1508792849-3115-19-git-send-email-paulmck@linux.vnet.ibm.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/tile')
-rw-r--r--arch/tile/gxio/dma_queue.c4
-rw-r--r--arch/tile/include/gxio/dma_queue.h2
-rw-r--r--arch/tile/kernel/ptrace.c2
3 files changed, 4 insertions, 4 deletions
diff --git a/arch/tile/gxio/dma_queue.c b/arch/tile/gxio/dma_queue.c
index baa60357f8ba..b7ba577d82ca 100644
--- a/arch/tile/gxio/dma_queue.c
+++ b/arch/tile/gxio/dma_queue.c
@@ -163,14 +163,14 @@ int __gxio_dma_queue_is_complete(__gxio_dma_queue_t *dma_queue,
163 int64_t completion_slot, int update) 163 int64_t completion_slot, int update)
164{ 164{
165 if (update) { 165 if (update) {
166 if (ACCESS_ONCE(dma_queue->hw_complete_count) > 166 if (READ_ONCE(dma_queue->hw_complete_count) >
167 completion_slot) 167 completion_slot)
168 return 1; 168 return 1;
169 169
170 __gxio_dma_queue_update_credits(dma_queue); 170 __gxio_dma_queue_update_credits(dma_queue);
171 } 171 }
172 172
173 return ACCESS_ONCE(dma_queue->hw_complete_count) > completion_slot; 173 return READ_ONCE(dma_queue->hw_complete_count) > completion_slot;
174} 174}
175 175
176EXPORT_SYMBOL_GPL(__gxio_dma_queue_is_complete); 176EXPORT_SYMBOL_GPL(__gxio_dma_queue_is_complete);
diff --git a/arch/tile/include/gxio/dma_queue.h b/arch/tile/include/gxio/dma_queue.h
index b9e45e37649e..c8fd47edba30 100644
--- a/arch/tile/include/gxio/dma_queue.h
+++ b/arch/tile/include/gxio/dma_queue.h
@@ -121,7 +121,7 @@ static inline int64_t __gxio_dma_queue_reserve(__gxio_dma_queue_t *dma_queue,
121 * if the result is LESS than "hw_complete_count". 121 * if the result is LESS than "hw_complete_count".
122 */ 122 */
123 uint64_t complete; 123 uint64_t complete;
124 complete = ACCESS_ONCE(dma_queue->hw_complete_count); 124 complete = READ_ONCE(dma_queue->hw_complete_count);
125 slot |= (complete & 0xffffffffff000000); 125 slot |= (complete & 0xffffffffff000000);
126 if (slot < complete) 126 if (slot < complete)
127 slot += 0x1000000; 127 slot += 0x1000000;
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index e1a078e6828e..d516d61751c2 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -255,7 +255,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
255 255
256int do_syscall_trace_enter(struct pt_regs *regs) 256int do_syscall_trace_enter(struct pt_regs *regs)
257{ 257{
258 u32 work = ACCESS_ONCE(current_thread_info()->flags); 258 u32 work = READ_ONCE(current_thread_info()->flags);
259 259
260 if ((work & _TIF_SYSCALL_TRACE) && 260 if ((work & _TIF_SYSCALL_TRACE) &&
261 tracehook_report_syscall_entry(regs)) { 261 tracehook_report_syscall_entry(regs)) {