[alsa-devel] [PATCH] ASoC: rsnd: stop all working stream when .remove
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Tue Oct 10 10:00:03 CEST 2017
Hi Takashi-san
> sorry for the late reply. It took time until I digest all pending
> stuff after vacation.
no problem
> > I added my local patch on this mail.
> > Maybe we want to separate this patch into few small patches.
> > but can you review this ?
> > It is including
> > - your patch
> > - snd_pcm_stop() snd_pcm_do_stop() care DISCONNECTED
>
> That needs a bit more investigation.
> When the device is disconnected, not all drivers expect that further
> PCM operations are done for non-existing devices. We might need
> either some flag to allow/prefer the stop-after-disconnection, or
> rethink whether we should actually stop at snd_pcm_dev_disconnect()
> like below.
Thank you for below patch.
I will check/test it
> ---
> diff --git a/sound/core/pcm.c b/sound/core/pcm.c
> index 7eadb7fd8074..054e47ad23ed 100644
> --- a/sound/core/pcm.c
> +++ b/sound/core/pcm.c
> @@ -1152,6 +1152,10 @@ static int snd_pcm_dev_disconnect(struct snd_device *device)
> for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) {
> snd_pcm_stream_lock_irq(substream);
> if (substream->runtime) {
> + if (snd_pcm_running(substream))
> + snd_pcm_stop(substream,
> + SNDRV_PCM_STATE_DISCONNECTED);
> + /* to be sure, set the state unconditionally */
> substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED;
> wake_up(&substream->runtime->sleep);
> wake_up(&substream->runtime->tsleep);
More information about the Alsa-devel
mailing list