ASoC: soc-pcm.c: Clear DAIs parameters after stream_active is updated
authorChancel Liu <chancel.liu@nxp.com>
Mon, 28 Nov 2022 06:09:50 +0000 (14:09 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 7 Dec 2022 20:05:16 +0000 (20:05 +0000)
commit1da681e52853f0abfbfff8c69833d31e538ff9c0
treea237901d457f4f9f85089d18765deaaa889ac495
parent81ed7d9de18768fe0cb3d74a7a163a8c082e1346
ASoC: soc-pcm.c: Clear DAIs parameters after stream_active is updated

DAIs parameters should be cleared if there's no active stream. Before,
we implemented it in soc_pcm_hw_free() by detecting stream_active. If
the running stream is the last active stream, we're going to clear
parameters.

However it will cause DAIs parameters never be cleared if there're
more than one stream. For example, we have stream1 and stream2 about
to stop. stream2 executes soc_pcm_hw_free() before stream1 executes
soc_pcm_close(). At the moment, stream2 should clear DAIs parameters.
Since stream_active is not yet updated by stream1 in soc_pcm_close(),
stream2 will not clear DAIs parameters. In result both stream1 and
stream2 don't clear the parameters.

This patch moves DAIs parameters cleanup after stream_active is
updated.

Signed-off-by: Chancel Liu <chancel.liu@nxp.com>
Link: https://lore.kernel.org/r/20221128060950.3540845-1-chancel.liu@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-pcm.c