A paused stream can retain outstanding driver requests. Moving it out of
PAUSED without the STOP trigger leaves device state paused, and skipping
stop_operating prevents the following sync_stop from cleaning it up.

Run the existing STOP and stop_operating path for PAUSED as well as
running streams. This replaces the earlier v7 proposal which only marked
stop_operating. Drivers now receive STOP when a paused stream is dropped
or stopped by an error. The change affects all PCM drivers.

Playback pause/drop/prepare/write and capture lifecycle tests exercise the
change. Physical drivers beyond virtio-snd still need review and testing.

Assisted-by: LLM
Signed-off-by: Joonho Lee <[email protected]>

---
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1607,7 +1607,8 @@
                           snd_pcm_state_t state)
 {
        if (substream->runtime->trigger_master == substream &&
-           snd_pcm_running(substream)) {
+           (snd_pcm_running(substream) ||
+            substream->runtime->state == SNDRV_PCM_STATE_PAUSED)) {
                substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_STOP);
                substream->runtime->stop_operating = true;
        }

Reply via email to