[PATCH 1/3] ASoC: soc-pcm.c: remove unnecessary codec2codec_close_delayed_work()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Tue Aug 30 05:17:03 CEST 2022


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

commit 4bf2e385aa59c2fae ("ASoC: core: Init pcm runtime work early to
avoid warnings") has added generic close_delayed_work() which checks
close_delayed_work_func

	static void close_delayed_work(...) {
		...
=>		if (rtd->close_delayed_work_func)
			rtd->close_delayed_work_func(rtd);
	}

So, we don't need to have NULL function for Codec2Codec.

=>	static void codec2codec_close_delayed_work()
	{
		/*
		 * Currently nothing to do for c2c links
		 * Since c2c links are internal nodes in the DAPM graph and
		 * don't interface with the outside world or application layer
		 * we don't have to do any special handling on close.
		 */
	}

	int soc_new_pcm(...)
	{
		...
		if (rtd->dai_link->params)
=>			rtd->close_delayed_work_func = codec2codec_close_delayed_work;
		else
			rtd->close_delayed_work_func = snd_soc_close_delayed_work;
		...
	}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 sound/soc/soc-pcm.c | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 7c4fbf992d90..cbb3db53321d 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -852,16 +852,6 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
 	return ret;
 }
 
-static void codec2codec_close_delayed_work(struct snd_soc_pcm_runtime *rtd)
-{
-	/*
-	 * Currently nothing to do for c2c links
-	 * Since c2c links are internal nodes in the DAPM graph and
-	 * don't interface with the outside world or application layer
-	 * we don't have to do any special handling on close.
-	 */
-}
-
 /*
  * Called by ALSA when the PCM substream is prepared, can set format, sample
  * rate, etc.  This function is non atomic and can be called multiple times,
@@ -2899,9 +2889,13 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
 		return ret;
 
 	/* DAPM dai link stream work */
-	if (rtd->dai_link->params)
-		rtd->close_delayed_work_func = codec2codec_close_delayed_work;
-	else
+	/*
+	 * Currently nothing to do for c2c links
+	 * Since c2c links are internal nodes in the DAPM graph and
+	 * don't interface with the outside world or application layer
+	 * we don't have to do any special handling on close.
+	 */
+	if (!rtd->dai_link->params)
 		rtd->close_delayed_work_func = snd_soc_close_delayed_work;
 
 	rtd->pcm = pcm;
-- 
2.25.1



More information about the Alsa-devel mailing list