summaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorVinod Koul <vkoul@kernel.org>2020-06-29 19:17:37 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-16 08:17:24 +0200
commitab8dbdcbfbf8e2f225ea1b74485304652c2b0f90 (patch)
treeb71e5553ba08acf8f962a39de1882eb89ea61a85 /sound/core
parent900387202702807237694a19bfc77fe5ad734172 (diff)
downloadlinux-stable-ab8dbdcbfbf8e2f225ea1b74485304652c2b0f90.tar.gz
linux-stable-ab8dbdcbfbf8e2f225ea1b74485304652c2b0f90.tar.bz2
linux-stable-ab8dbdcbfbf8e2f225ea1b74485304652c2b0f90.zip
ALSA: compress: fix partial_drain completion state
[ Upstream commit f79a732a8325dfbd570d87f1435019d7e5501c6d ] On partial_drain completion we should be in SNDRV_PCM_STATE_RUNNING state, so set that for partially draining streams in snd_compr_drain_notify() and use a flag for partially draining streams While at it, add locks for stream state change in snd_compr_drain_notify() as well. Fixes: f44f2a5417b2 ("ALSA: compress: fix drain calls blocking other compress functions (v6)") Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Vinod Koul <vkoul@kernel.org> Link: https://lore.kernel.org/r/20200629134737.105993-4-vkoul@kernel.org Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/compress_offload.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
index 509038d6bccd..68f016e4929a 100644
--- a/sound/core/compress_offload.c
+++ b/sound/core/compress_offload.c
@@ -723,6 +723,9 @@ static int snd_compr_stop(struct snd_compr_stream *stream)
retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP);
if (!retval) {
+ /* clear flags and stop any drain wait */
+ stream->partial_drain = false;
+ stream->metadata_set = false;
snd_compr_drain_notify(stream);
stream->runtime->total_bytes_available = 0;
stream->runtime->total_bytes_transferred = 0;
@@ -880,6 +883,7 @@ static int snd_compr_partial_drain(struct snd_compr_stream *stream)
if (stream->next_track == false)
return -EPERM;
+ stream->partial_drain = true;
retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_PARTIAL_DRAIN);
if (retval) {
pr_debug("Partial drain returned failure\n");