[6/7] ASoC: soc-link: add snd_soc_link_compr_shutdown()
diff mbox series

Message ID 87y2po4u07.wl-kuninori.morimoto.gx@renesas.com
State New
Headers show
Series
  • ASoC: add soc-link
Related show

Commit Message

Kuninori Morimoto May 19, 2020, 1:02 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

dai_link related function should be implemented at soc-link.c.
This patch adds snd_soc_link_compr_shutdown().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-link.h | 2 ++
 sound/soc/soc-compress.c | 6 ++----
 sound/soc/soc-link.c     | 9 +++++++++
 3 files changed, 13 insertions(+), 4 deletions(-)

Patch
diff mbox series

diff --git a/include/sound/soc-link.h b/include/sound/soc-link.h
index c152576cbd87..83ca7301c91b 100644
--- a/include/sound/soc-link.h
+++ b/include/sound/soc-link.h
@@ -22,5 +22,7 @@  int snd_soc_link_trigger(struct snd_pcm_substream *substream, int cmd);
 
 int snd_soc_link_compr_startup(struct snd_soc_pcm_runtime *rtd,
 			       struct snd_compr_stream *cstream);
+void snd_soc_link_compr_shutdown(struct snd_soc_pcm_runtime *rtd,
+				 struct snd_compr_stream *cstream);
 
 #endif /* __SOC_LINK_H */
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 35b0af86325a..9db7810bbe04 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -226,8 +226,7 @@  static int soc_compr_free(struct snd_compr_stream *cstream)
 	if (!snd_soc_dai_active(codec_dai))
 		codec_dai->rate = 0;
 
-	if (rtd->dai_link->compr_ops && rtd->dai_link->compr_ops->shutdown)
-		rtd->dai_link->compr_ops->shutdown(cstream);
+	snd_soc_link_compr_shutdown(rtd, cstream);
 
 	soc_compr_components_free(cstream, NULL);
 
@@ -282,8 +281,7 @@  static int soc_compr_free_fe(struct snd_compr_stream *cstream)
 
 	fe->dpcm[stream].runtime = NULL;
 
-	if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->shutdown)
-		fe->dai_link->compr_ops->shutdown(cstream);
+	snd_soc_link_compr_shutdown(fe, cstream);
 
 	soc_compr_components_free(cstream, NULL);
 
diff --git a/sound/soc/soc-link.c b/sound/soc/soc-link.c
index dddc4a35a0ac..bad719176379 100644
--- a/sound/soc/soc-link.c
+++ b/sound/soc/soc-link.c
@@ -125,3 +125,12 @@  int snd_soc_link_compr_startup(struct snd_soc_pcm_runtime *rtd,
 	return soc_link_ret(rtd, ret);
 }
 EXPORT_SYMBOL_GPL(snd_soc_link_compr_startup);
+
+void snd_soc_link_compr_shutdown(struct snd_soc_pcm_runtime *rtd,
+				 struct snd_compr_stream *cstream)
+{
+	if (rtd->dai_link->compr_ops &&
+	    rtd->dai_link->compr_ops->shutdown)
+		rtd->dai_link->compr_ops->shutdown(cstream);
+}
+EXPORT_SYMBOL_GPL(snd_soc_link_compr_shutdown);