1 From 48113d6d98bd0f810b439741bb0da982b1abe4c1 Mon Sep 17 00:00:00 2001
2 From: Takashi Iwai <tiwai@suse.de>
3 Date: Tue, 4 Sep 2018 17:58:33 +0200
4 Subject: [PATCH 443/703] staging: bcm2835-audio: Remove redundant substream
7 commit 14b1f4cba853a11c7b381ad919622f38eb194bd7 upstream.
9 The avail_substreams bit mask is checked for the possible racy
10 accesses, but this cannot happen in practice; i.e. the assignment and
11 the check are superfluous.
15 Signed-off-by: Takashi Iwai <tiwai@suse.de>
16 Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19 .../vc04_services/bcm2835-audio/bcm2835-ctl.c | 2 --
20 .../vc04_services/bcm2835-audio/bcm2835-pcm.c | 8 --------
21 .../vc04_services/bcm2835-audio/bcm2835-vchiq.c | 17 +++++++----------
22 .../vc04_services/bcm2835-audio/bcm2835.c | 5 +----
23 .../vc04_services/bcm2835-audio/bcm2835.h | 2 --
24 5 files changed, 8 insertions(+), 26 deletions(-)
26 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
27 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-ctl.c
28 @@ -64,8 +64,6 @@ static int snd_bcm2835_ctl_get(struct sn
30 mutex_lock(&chip->audio_mutex);
32 - BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));
34 if (kcontrol->private_value == PCM_PLAYBACK_VOLUME)
35 ucontrol->value.integer.value[0] = chip2alsa(chip->volume);
36 else if (kcontrol->private_value == PCM_PLAYBACK_MUTE)
37 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
38 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
39 @@ -118,14 +118,6 @@ static int snd_bcm2835_playback_open_gen
43 - /* Check if we are ready */
44 - if (!(chip->avail_substreams & (1 << idx))) {
45 - /* We are not ready yet */
46 - audio_error("substream(%d) device is not ready yet\n", idx);
51 alsa_stream = kzalloc(sizeof(*alsa_stream), GFP_KERNEL);
54 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
55 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
56 @@ -523,16 +523,13 @@ int bcm2835_audio_set_ctls(struct bcm283
58 /* change ctls for all substreams */
59 for (i = 0; i < MAX_SUBSTREAMS; i++) {
60 - if (chip->avail_substreams & (1 << i)) {
61 - if (!chip->alsa_stream[i]) {
62 - LOG_DBG(" No ALSA stream available?! %i:%p (%x)\n", i, chip->alsa_stream[i], chip->avail_substreams);
64 - } else if (bcm2835_audio_set_ctls_chan(chip->alsa_stream[i], chip) != 0) {
65 - LOG_ERR("Couldn't set the controls for stream %d\n", i);
68 - LOG_DBG(" Controls set for stream %d\n", i);
70 + if (!chip->alsa_stream[i])
72 + if (bcm2835_audio_set_ctls_chan(chip->alsa_stream[i], chip) != 0) {
73 + LOG_ERR("Couldn't set the controls for stream %d\n", i);
76 + LOG_DBG(" Controls set for stream %d\n", i);
80 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
81 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
82 @@ -280,7 +280,7 @@ static int snd_add_child_device(struct d
83 struct snd_card *card;
85 struct bcm2835_chip *chip;
89 child = snd_create_device(device, &audio_driver->driver,
90 audio_driver->driver.name);
91 @@ -325,9 +325,6 @@ static int snd_add_child_device(struct d
95 - for (i = 0; i < numchans; i++)
96 - chip->avail_substreams |= (1 << i);
98 err = snd_card_register(card);
100 dev_err(child, "Failed to register card, error %d\n", err);
101 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
102 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
103 @@ -98,8 +98,6 @@ struct bcm2835_chip {
104 struct snd_card *card;
106 struct snd_pcm *pcm_spdif;
107 - /* Bitmat for valid reg_base and irq numbers */
108 - unsigned int avail_substreams;
110 struct bcm2835_alsa_stream *alsa_stream[MAX_SUBSTREAMS];