diff mbox series

[v3,3/7] ASoC: soc-link: remove unneeded parameter from snd_soc_link_xxx()

Message ID 87h7w84yif.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show
Series ASoC: add soc-link | expand

Commit Message

Kuninori Morimoto May 22, 2020, 12:14 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

"rtd" can be created from "substream".
Let's cleanup snd_soc_link_xxx().

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-link.h | 18 ++++++------------
 sound/soc/soc-link.c     | 26 ++++++++++++++------------
 sound/soc/soc-pcm.c      | 12 ++++++------
 3 files changed, 26 insertions(+), 30 deletions(-)
diff mbox series

Patch

diff --git a/include/sound/soc-link.h b/include/sound/soc-link.h
index 689aa93be78e..2a81dca945cd 100644
--- a/include/sound/soc-link.h
+++ b/include/sound/soc-link.h
@@ -9,18 +9,12 @@ 
 #define __SOC_LINK_H
 
 int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd);
-int snd_soc_link_startup(struct snd_soc_pcm_runtime *rtd,
-			 struct snd_pcm_substream *substream);
-void snd_soc_link_shutdown(struct snd_soc_pcm_runtime *rtd,
-			   struct snd_pcm_substream *substream);
-int snd_soc_link_prepare(struct snd_soc_pcm_runtime *rtd,
-			 struct snd_pcm_substream *substream);
-int snd_soc_link_hw_params(struct snd_soc_pcm_runtime *rtd,
-			   struct snd_pcm_substream *substream,
+int snd_soc_link_startup(struct snd_pcm_substream *substream);
+void snd_soc_link_shutdown(struct snd_pcm_substream *substream);
+int snd_soc_link_prepare(struct snd_pcm_substream *substream);
+int snd_soc_link_hw_params(struct snd_pcm_substream *substream,
 			   struct snd_pcm_hw_params *params);
-void snd_soc_link_hw_free(struct snd_soc_pcm_runtime *rtd,
-			  struct snd_pcm_substream *substream);
-int snd_soc_link_trigger(struct snd_soc_pcm_runtime *rtd,
-			 struct snd_pcm_substream *substream, int cmd);
+void snd_soc_link_hw_free(struct snd_pcm_substream *substream);
+int snd_soc_link_trigger(struct snd_pcm_substream *substream, int cmd);
 
 #endif /* __SOC_LINK_H */
diff --git a/sound/soc/soc-link.c b/sound/soc/soc-link.c
index 3cb5d1f52e85..5ce3e209b1a8 100644
--- a/sound/soc/soc-link.c
+++ b/sound/soc/soc-link.c
@@ -36,9 +36,9 @@  int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd)
 	return soc_link_ret(rtd, ret);
 }
 
-int snd_soc_link_startup(struct snd_soc_pcm_runtime *rtd,
-			 struct snd_pcm_substream *substream)
+int snd_soc_link_startup(struct snd_pcm_substream *substream)
 {
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	int ret = 0;
 
 	if (rtd->dai_link->ops &&
@@ -48,17 +48,18 @@  int snd_soc_link_startup(struct snd_soc_pcm_runtime *rtd,
 	return soc_link_ret(rtd, ret);
 }
 
-void snd_soc_link_shutdown(struct snd_soc_pcm_runtime *rtd,
-			   struct snd_pcm_substream *substream)
+void snd_soc_link_shutdown(struct snd_pcm_substream *substream)
 {
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+
 	if (rtd->dai_link->ops &&
 	    rtd->dai_link->ops->shutdown)
 		rtd->dai_link->ops->shutdown(substream);
 }
 
-int snd_soc_link_prepare(struct snd_soc_pcm_runtime *rtd,
-			 struct snd_pcm_substream *substream)
+int snd_soc_link_prepare(struct snd_pcm_substream *substream)
 {
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	int ret = 0;
 
 	if (rtd->dai_link->ops &&
@@ -68,10 +69,10 @@  int snd_soc_link_prepare(struct snd_soc_pcm_runtime *rtd,
 	return soc_link_ret(rtd, ret);
 }
 
-int snd_soc_link_hw_params(struct snd_soc_pcm_runtime *rtd,
-			   struct snd_pcm_substream *substream,
+int snd_soc_link_hw_params(struct snd_pcm_substream *substream,
 			   struct snd_pcm_hw_params *params)
 {
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	int ret = 0;
 
 	if (rtd->dai_link->ops &&
@@ -81,17 +82,18 @@  int snd_soc_link_hw_params(struct snd_soc_pcm_runtime *rtd,
 	return soc_link_ret(rtd, ret);
 }
 
-void snd_soc_link_hw_free(struct snd_soc_pcm_runtime *rtd,
-			  struct snd_pcm_substream *substream)
+void snd_soc_link_hw_free(struct snd_pcm_substream *substream)
 {
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+
 	if (rtd->dai_link->ops &&
 	    rtd->dai_link->ops->hw_free)
 		rtd->dai_link->ops->hw_free(substream);
 }
 
-int snd_soc_link_trigger(struct snd_soc_pcm_runtime *rtd,
-			 struct snd_pcm_substream *substream, int cmd)
+int snd_soc_link_trigger(struct snd_pcm_substream *substream, int cmd)
 {
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	int ret = 0;
 
 	if (rtd->dai_link->ops &&
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index f79e2305dcc9..0204a3ecfc8b 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -683,7 +683,7 @@  static int soc_pcm_close(struct snd_pcm_substream *substream)
 	for_each_rtd_dais(rtd, i, dai)
 		snd_soc_dai_shutdown(dai, substream);
 
-	snd_soc_link_shutdown(rtd, substream);
+	snd_soc_link_shutdown(substream);
 
 	soc_pcm_components_close(substream);
 
@@ -814,7 +814,7 @@  static int soc_pcm_open(struct snd_pcm_substream *substream)
 	for_each_rtd_dais(rtd, i, dai)
 		snd_soc_dai_shutdown(dai, substream);
 
-	snd_soc_link_shutdown(rtd, substream);
+	snd_soc_link_shutdown(substream);
 rtd_startup_err:
 	soc_pcm_components_close(substream);
 component_err:
@@ -1055,7 +1055,7 @@  static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
 		codec_dai->rate = 0;
 	}
 
-	snd_soc_link_hw_free(rtd, substream);
+	snd_soc_link_hw_free(substream);
 
 	mutex_unlock(&rtd->card->pcm_mutex);
 	return ret;
@@ -1087,7 +1087,7 @@  static int soc_pcm_hw_free(struct snd_pcm_substream *substream)
 	}
 
 	/* free any machine hw params */
-	snd_soc_link_hw_free(rtd, substream);
+	snd_soc_link_hw_free(substream);
 
 	/* free any component resources */
 	soc_pcm_components_hw_free(substream, NULL);
@@ -1110,7 +1110,7 @@  static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd)
 	struct snd_soc_component *component;
 	int i, ret;
 
-	ret = snd_soc_link_trigger(rtd, substream, cmd);
+	ret = snd_soc_link_trigger(substream, cmd);
 	if (ret < 0)
 		return ret;
 
@@ -1139,7 +1139,7 @@  static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd)
 			return ret;
 	}
 
-	ret = snd_soc_link_trigger(rtd, substream, cmd);
+	ret = snd_soc_link_trigger(substream, cmd);
 	if (ret < 0)
 		return ret;