summaryrefslogtreecommitdiffstats
path: root/sound/firewire/fireface
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 /sound/firewire/fireface
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 'sound/firewire/fireface')
-rw-r--r--sound/firewire/fireface/amdtp-ff.c4
-rw-r--r--sound/firewire/fireface/ff-midi.c10
-rw-r--r--sound/firewire/fireface/ff-transaction.c8
3 files changed, 11 insertions, 11 deletions
diff --git a/sound/firewire/fireface/amdtp-ff.c b/sound/firewire/fireface/amdtp-ff.c
index 780da9deb2f0..77c7598b61ab 100644
--- a/sound/firewire/fireface/amdtp-ff.c
+++ b/sound/firewire/fireface/amdtp-ff.c
@@ -108,7 +108,7 @@ static unsigned int process_rx_data_blocks(struct amdtp_stream *s,
108 unsigned int data_blocks, 108 unsigned int data_blocks,
109 unsigned int *syt) 109 unsigned int *syt)
110{ 110{
111 struct snd_pcm_substream *pcm = ACCESS_ONCE(s->pcm); 111 struct snd_pcm_substream *pcm = READ_ONCE(s->pcm);
112 unsigned int pcm_frames; 112 unsigned int pcm_frames;
113 113
114 if (pcm) { 114 if (pcm) {
@@ -127,7 +127,7 @@ static unsigned int process_tx_data_blocks(struct amdtp_stream *s,
127 unsigned int data_blocks, 127 unsigned int data_blocks,
128 unsigned int *syt) 128 unsigned int *syt)
129{ 129{
130 struct snd_pcm_substream *pcm = ACCESS_ONCE(s->pcm); 130 struct snd_pcm_substream *pcm = READ_ONCE(s->pcm);
131 unsigned int pcm_frames; 131 unsigned int pcm_frames;
132 132
133 if (pcm) { 133 if (pcm) {
diff --git a/sound/firewire/fireface/ff-midi.c b/sound/firewire/fireface/ff-midi.c
index 949ee56b4e0e..6a49611ee462 100644
--- a/sound/firewire/fireface/ff-midi.c
+++ b/sound/firewire/fireface/ff-midi.c
@@ -22,7 +22,7 @@ static int midi_playback_open(struct snd_rawmidi_substream *substream)
22 ff->running_status[substream->number] = 0; 22 ff->running_status[substream->number] = 0;
23 ff->rx_midi_error[substream->number] = false; 23 ff->rx_midi_error[substream->number] = false;
24 24
25 ACCESS_ONCE(ff->rx_midi_substreams[substream->number]) = substream; 25 WRITE_ONCE(ff->rx_midi_substreams[substream->number], substream);
26 26
27 return 0; 27 return 0;
28} 28}
@@ -38,7 +38,7 @@ static int midi_playback_close(struct snd_rawmidi_substream *substream)
38 struct snd_ff *ff = substream->rmidi->private_data; 38 struct snd_ff *ff = substream->rmidi->private_data;
39 39
40 cancel_work_sync(&ff->rx_midi_work[substream->number]); 40 cancel_work_sync(&ff->rx_midi_work[substream->number]);
41 ACCESS_ONCE(ff->rx_midi_substreams[substream->number]) = NULL; 41 WRITE_ONCE(ff->rx_midi_substreams[substream->number], NULL);
42 42
43 return 0; 43 return 0;
44} 44}
@@ -52,10 +52,10 @@ static void midi_capture_trigger(struct snd_rawmidi_substream *substream,
52 spin_lock_irqsave(&ff->lock, flags); 52 spin_lock_irqsave(&ff->lock, flags);
53 53
54 if (up) 54 if (up)
55 ACCESS_ONCE(ff->tx_midi_substreams[substream->number]) = 55 WRITE_ONCE(ff->tx_midi_substreams[substream->number],
56 substream; 56 substream);
57 else 57 else
58 ACCESS_ONCE(ff->tx_midi_substreams[substream->number]) = NULL; 58 WRITE_ONCE(ff->tx_midi_substreams[substream->number], NULL);
59 59
60 spin_unlock_irqrestore(&ff->lock, flags); 60 spin_unlock_irqrestore(&ff->lock, flags);
61} 61}
diff --git a/sound/firewire/fireface/ff-transaction.c b/sound/firewire/fireface/ff-transaction.c
index dd6c8e839647..332b29f8ed75 100644
--- a/sound/firewire/fireface/ff-transaction.c
+++ b/sound/firewire/fireface/ff-transaction.c
@@ -12,7 +12,7 @@ static void finish_transmit_midi_msg(struct snd_ff *ff, unsigned int port,
12 int rcode) 12 int rcode)
13{ 13{
14 struct snd_rawmidi_substream *substream = 14 struct snd_rawmidi_substream *substream =
15 ACCESS_ONCE(ff->rx_midi_substreams[port]); 15 READ_ONCE(ff->rx_midi_substreams[port]);
16 16
17 if (rcode_is_permanent_error(rcode)) { 17 if (rcode_is_permanent_error(rcode)) {
18 ff->rx_midi_error[port] = true; 18 ff->rx_midi_error[port] = true;
@@ -60,7 +60,7 @@ static inline void fill_midi_buf(struct snd_ff *ff, unsigned int port,
60static void transmit_midi_msg(struct snd_ff *ff, unsigned int port) 60static void transmit_midi_msg(struct snd_ff *ff, unsigned int port)
61{ 61{
62 struct snd_rawmidi_substream *substream = 62 struct snd_rawmidi_substream *substream =
63 ACCESS_ONCE(ff->rx_midi_substreams[port]); 63 READ_ONCE(ff->rx_midi_substreams[port]);
64 u8 *buf = (u8 *)ff->msg_buf[port]; 64 u8 *buf = (u8 *)ff->msg_buf[port];
65 int i, len; 65 int i, len;
66 66
@@ -159,7 +159,7 @@ static void handle_midi_msg(struct fw_card *card, struct fw_request *request,
159 */ 159 */
160 index = (quad >> 8) & 0xff; 160 index = (quad >> 8) & 0xff;
161 if (index > 0) { 161 if (index > 0) {
162 substream = ACCESS_ONCE(ff->tx_midi_substreams[0]); 162 substream = READ_ONCE(ff->tx_midi_substreams[0]);
163 if (substream != NULL) { 163 if (substream != NULL) {
164 byte = quad & 0xff; 164 byte = quad & 0xff;
165 snd_rawmidi_receive(substream, &byte, 1); 165 snd_rawmidi_receive(substream, &byte, 1);
@@ -169,7 +169,7 @@ static void handle_midi_msg(struct fw_card *card, struct fw_request *request,
169 /* Message in second port. */ 169 /* Message in second port. */
170 index = (quad >> 24) & 0xff; 170 index = (quad >> 24) & 0xff;
171 if (index > 0) { 171 if (index > 0) {
172 substream = ACCESS_ONCE(ff->tx_midi_substreams[1]); 172 substream = READ_ONCE(ff->tx_midi_substreams[1]);
173 if (substream != NULL) { 173 if (substream != NULL) {
174 byte = (quad >> 16) & 0xff; 174 byte = (quad >> 16) & 0xff;
175 snd_rawmidi_receive(substream, &byte, 1); 175 snd_rawmidi_receive(substream, &byte, 1);