1 From af2fe52ef43c1aa6a24d1c51ad3ccddc39a12c51 Mon Sep 17 00:00:00 2001
2 From: Takashi Iwai <tiwai@suse.de>
3 Date: Tue, 4 Sep 2018 17:58:36 +0200
4 Subject: [PATCH] staging: bcm2835-audio: Remove superfluous open flag
6 commit ad13924de6b07cb52714ea1809c57b2e72a24504 upstream.
8 All the alsa_stream->open flag checks in the current code are
9 redundant, and they cannot be racy. For the code simplification,
10 let's remove the flag and its check.
12 Signed-off-by: Takashi Iwai <tiwai@suse.de>
13 Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
14 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16 .../staging/vc04_services/bcm2835-audio/bcm2835-pcm.c | 9 ++-------
17 drivers/staging/vc04_services/bcm2835-audio/bcm2835.h | 1 -
18 2 files changed, 2 insertions(+), 8 deletions(-)
20 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
21 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
22 @@ -57,8 +57,7 @@ void bcm2835_playback_fifo(struct bcm283
23 audio_info("alsa_stream=%p substream=%p\n", alsa_stream,
24 alsa_stream ? alsa_stream->substream : 0);
26 - if (alsa_stream->open)
27 - consumed = bcm2835_audio_retrieve_buffers(alsa_stream);
28 + consumed = bcm2835_audio_retrieve_buffers(alsa_stream);
30 /* We get called only if playback was triggered, So, the number of buffers we retrieve in
31 * each iteration are the buffers that have been played out already
32 @@ -154,7 +153,6 @@ static int snd_bcm2835_playback_open_gen
33 chip->alsa_stream[idx] = alsa_stream;
35 chip->opened |= (1 << idx);
36 - alsa_stream->open = 1;
37 alsa_stream->draining = 1;
40 @@ -205,10 +203,7 @@ static int snd_bcm2835_playback_close(st
41 alsa_stream->period_size = 0;
42 alsa_stream->buffer_size = 0;
44 - if (alsa_stream->open) {
45 - alsa_stream->open = 0;
46 - bcm2835_audio_close(alsa_stream);
48 + bcm2835_audio_close(alsa_stream);
49 if (alsa_stream->chip)
50 alsa_stream->chip->alsa_stream[alsa_stream->idx] = NULL;
52 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
53 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
54 @@ -121,7 +121,6 @@ struct bcm2835_alsa_stream {