Message ID | s5hshew5s7v.wl-tiwai@suse.de (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
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);
Hi Takashi-san, again > > > 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 It solved my issue (without strange status magic :). I posted this patch-set. [1/3] is your patch but I posted. Please check (and fix) it Best regards --- Kuninori Morimoto
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);