e4aa7ce22b08aebacc25d3d06c0412c6f954b417
[oweals/openwrt.git] /
1 From e09b2224769855077ccd9a16efb5949b6520b6ee 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 441/773] staging: bcm2835-audio: Remove superfluous open flag
5
6 commit ad13924de6b07cb52714ea1809c57b2e72a24504 upstream.
7
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.
11
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>
15 ---
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(-)
19
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);
25  
26 -       if (alsa_stream->open)
27 -               consumed = bcm2835_audio_retrieve_buffers(alsa_stream);
28 +       consumed = bcm2835_audio_retrieve_buffers(alsa_stream);
29  
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;
34  
35         chip->opened |= (1 << idx);
36 -       alsa_stream->open = 1;
37         alsa_stream->draining = 1;
38  
39  out:
40 @@ -205,10 +203,7 @@ static int snd_bcm2835_playback_close(st
41         alsa_stream->period_size = 0;
42         alsa_stream->buffer_size = 0;
43  
44 -       if (alsa_stream->open) {
45 -               alsa_stream->open = 0;
46 -               bcm2835_audio_close(alsa_stream);
47 -       }
48 +       bcm2835_audio_close(alsa_stream);
49         if (alsa_stream->chip)
50                 alsa_stream->chip->alsa_stream[alsa_stream->idx] = NULL;
51         /*
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 {
55  
56         spinlock_t lock;
57  
58 -       int open;
59         int running;
60         int draining;
61