Skip to content

Commit 7011cd4

Browse files
tiwaigregkh
authored andcommitted
ALSA: pcm: Assure sync with the pending stop operation at suspend
commit 2c87c1a upstream. The current PCM code calls the sync_stop at the resume action due to the analogy to the PCM prepare call pattern. But, it makes little sense, as the sync should have been done rather at the suspend time, not at the resume time. This patch corrects the sync_stop call at suspend/resume to assure the sync before finishing the suspend. Fixes: 1e850be ("ALSA: pcm: Add the support for sync-stop operation") Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20210206203656.15959-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6bcf443 commit 7011cd4

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

‎sound/core/pcm_native.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1615,6 +1615,7 @@ static int snd_pcm_do_suspend(struct snd_pcm_substream *substream,
16151615
if (! snd_pcm_running(substream))
16161616
return 0;
16171617
substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_SUSPEND);
1618+
runtime->stop_operating = true;
16181619
return 0; /* suspend unconditionally */
16191620
}
16201621

@@ -1691,6 +1692,12 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm)
16911692
return err;
16921693
}
16931694
}
1695+
1696+
for (stream = 0; stream < 2; stream++)
1697+
for (substream = pcm->streams[stream].substream;
1698+
substream; substream = substream->next)
1699+
snd_pcm_sync_stop(substream, false);
1700+
16941701
return 0;
16951702
}
16961703
EXPORT_SYMBOL(snd_pcm_suspend_all);
@@ -1736,7 +1743,6 @@ static void snd_pcm_post_resume(struct snd_pcm_substream *substream,
17361743
snd_pcm_trigger_tstamp(substream);
17371744
runtime->status->state = runtime->status->suspended_state;
17381745
snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MRESUME);
1739-
snd_pcm_sync_stop(substream, true);
17401746
}
17411747

17421748
static const struct action_ops snd_pcm_action_resume = {

0 commit comments

Comments
 (0)