Applied "ASoC: soc-pcm: check DAI's activity more simply" to the asoc tree

Mark Brown broonie at kernel.org
Fri Mar 6 16:03:12 CET 2020


The patch

   ASoC: soc-pcm: check DAI's activity more simply

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 67ad877757cea329f74c1e169ec54131c3f223ce Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
Date: Fri, 6 Mar 2020 10:10:04 +0900
Subject: [PATCH] ASoC: soc-pcm: check DAI's activity more simply

soc_pcm_hw_free() want to call snd_soc_dai_digital_mute()
if it was last user of Playback or Capture.

	bool playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
	int playback_active = dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK];
	int capture_active  = dai->stream_active[SNDRV_PCM_STREAM_CAPTURE];

	if ((playback  && playback_active == 1) ||
	    (!playback && capture_active  == 1))
		snd_soc_dai_digital_mute(...)

But it is same as

	int active = dai->stream_active[substream->stream];

	if (active == 1)
		snd_soc_dai_digital_mute(...)

This patch simplify the code.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
Link: https://lore.kernel.org/r/87k13yp9ub.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie at kernel.org>
---
 sound/soc/soc-pcm.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 7d787e0966f3..af0e17bfeeab 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1202,7 +1202,6 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_dai *cpu_dai;
 	struct snd_soc_dai *codec_dai;
-	bool playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
 	int i;
 
 	mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
@@ -1226,11 +1225,9 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
 
 	/* apply codec digital mute */
 	for_each_rtd_codec_dai(rtd, i, codec_dai) {
-		int playback_active = codec_dai->stream_active[SNDRV_PCM_STREAM_PLAYBACK];
-		int capture_active  = codec_dai->stream_active[SNDRV_PCM_STREAM_CAPTURE];
+		int active = codec_dai->stream_active[substream->stream];
 
-		if ((playback && playback_active == 1) ||
-		    (!playback && capture_active == 1))
+		if (active == 1)
 			snd_soc_dai_digital_mute(codec_dai, 1,
 						 substream->stream);
 	}
-- 
2.20.1



More information about the Alsa-devel mailing list