1 From 2dd8625b99a3244bf632278cd7fdd74dffaeb3a3 Mon Sep 17 00:00:00 2001
2 From: Takashi Iwai <tiwai@suse.de>
3 Date: Tue, 4 Sep 2018 17:58:37 +0200
4 Subject: [PATCH 447/703] staging: bcm2835-audio: Drop useless running flag and
7 commit 02f2376321d75e78117f39ff81f215254ee6b4ef upstream.
9 The running flag of alsa_stream is basically useless. The running
10 state is strictly controlled in ALSA PCM core side, hence the check in
11 PCM trigger and close callbacks are superfluous.
13 Also, the prefill ack at trigger start became superfluous nowadays
14 with the ALSA PCM core update.
18 Signed-off-by: Takashi Iwai <tiwai@suse.de>
19 Tested-by: Stefan Wahren <stefan.wahren@i2se.com>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22 .../vc04_services/bcm2835-audio/bcm2835-pcm.c | 46 ++++---------------
23 .../vc04_services/bcm2835-audio/bcm2835.h | 1 -
24 2 files changed, 8 insertions(+), 39 deletions(-)
26 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
27 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-pcm.c
28 @@ -187,19 +187,6 @@ static int snd_bcm2835_playback_close(st
30 audio_info("Alsa close\n");
33 - * Call stop if it's still running. This happens when app
34 - * is force killed and we don't get a stop trigger.
36 - if (alsa_stream->running) {
39 - err = bcm2835_audio_stop(alsa_stream);
40 - alsa_stream->running = 0;
42 - audio_error(" Failed to STOP alsa device\n");
45 alsa_stream->period_size = 0;
46 alsa_stream->buffer_size = 0;
48 @@ -324,27 +311,13 @@ static int snd_bcm2835_pcm_trigger(struc
51 case SNDRV_PCM_TRIGGER_START:
52 - audio_debug("bcm2835_AUDIO_TRIGGER_START running=%d\n",
53 - alsa_stream->running);
54 - if (!alsa_stream->running) {
55 - err = bcm2835_audio_start(alsa_stream);
57 - alsa_stream->pcm_indirect.hw_io =
58 - alsa_stream->pcm_indirect.hw_data =
59 - bytes_to_frames(runtime,
61 - substream->ops->ack(substream);
62 - alsa_stream->running = 1;
63 - alsa_stream->draining = 1;
65 - audio_error(" Failed to START alsa device (%d)\n", err);
68 + err = bcm2835_audio_start(alsa_stream);
70 + alsa_stream->draining = 1;
72 + audio_error(" Failed to START alsa device (%d)\n", err);
74 case SNDRV_PCM_TRIGGER_STOP:
76 - ("bcm2835_AUDIO_TRIGGER_STOP running=%d draining=%d\n",
77 - alsa_stream->running, runtime->status->state == SNDRV_PCM_STATE_DRAINING);
78 if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) {
79 audio_info("DRAINING\n");
80 alsa_stream->draining = 1;
81 @@ -352,12 +325,9 @@ static int snd_bcm2835_pcm_trigger(struc
82 audio_info("DROPPING\n");
83 alsa_stream->draining = 0;
85 - if (alsa_stream->running) {
86 - err = bcm2835_audio_stop(alsa_stream);
88 - audio_error(" Failed to STOP alsa device (%d)\n", err);
89 - alsa_stream->running = 0;
91 + err = bcm2835_audio_stop(alsa_stream);
93 + audio_error(" Failed to STOP alsa device (%d)\n", err);
97 --- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
98 +++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835.h
99 @@ -121,7 +121,6 @@ struct bcm2835_alsa_stream {