All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: [PATCH 3/7] ASoC: soc-link: remove unneeded parameter from snd_soc_link_xxx()
Date: 19 May 2020 10:01:53 +0900	[thread overview]
Message-ID: <87367w68la.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <877dx868op.wl-kuninori.morimoto.gx@renesas.com>

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      | 18 +++++++++---------
 3 files changed, 29 insertions(+), 33 deletions(-)

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 be6a6ecfc9dc..691910e82bff 100644
--- a/sound/soc/soc-link.c
+++ b/sound/soc/soc-link.c
@@ -35,9 +35,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 &&
@@ -47,17 +47,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 &&
@@ -67,10 +68,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 &&
@@ -80,17 +81,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 20857145bd6d..2b5068001efb 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -682,7 +682,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);
 
@@ -729,7 +729,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
 	if (ret < 0)
 		goto component_err;
 
-	ret = snd_soc_link_startup(rtd, substream);
+	ret = snd_soc_link_startup(substream);
 	if (ret < 0) {
 		pr_err("ASoC: %s startup failed: %d\n",
 		       rtd->dai_link->name, ret);
@@ -816,7 +816,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:
@@ -858,7 +858,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
 
 	mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
 
-	ret = snd_soc_link_prepare(rtd, substream);
+	ret = snd_soc_link_prepare(substream);
 	if (ret < 0) {
 		dev_err(rtd->card->dev,
 			"ASoC: machine prepare error: %d\n", ret);
@@ -948,7 +948,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
 	if (ret)
 		goto out;
 
-	ret = snd_soc_link_hw_params(rtd, substream, params);
+	ret = snd_soc_link_hw_params(substream, params);
 	if (ret < 0) {
 		dev_err(rtd->card->dev,
 			"ASoC: machine hw_params failed: %d\n", ret);
@@ -1063,7 +1063,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;
@@ -1095,7 +1095,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);
@@ -1118,7 +1118,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;
 
@@ -1147,7 +1147,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;
 
-- 
2.17.1


  parent reply	other threads:[~2020-05-19  1:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-19  0:59 [PATCH 0/7] ASoC: add soc-link Kuninori Morimoto
2020-05-19  1:01 ` [PATCH 1/7] ASoC: add soc-link.c Kuninori Morimoto
2020-05-19  1:42   ` Ranjani Sridharan
2020-05-19  4:20     ` Kuninori Morimoto
2020-05-19  1:01 ` [PATCH 2/7] ASoC: soc-link: move soc_rtd_xxx() Kuninori Morimoto
2020-05-19  1:01 ` Kuninori Morimoto [this message]
2020-05-19  1:02 ` [PATCH 4/7] ASoC: soc-link: add snd_soc_link_be_hw_params_fixup() Kuninori Morimoto
2020-05-19  1:45   ` Ranjani Sridharan
2020-05-19  4:16     ` Kuninori Morimoto
2020-05-19  1:02 ` [PATCH 5/7] ASoC: soc-link: add snd_soc_link_compr_startup() Kuninori Morimoto
2020-05-19  1:47   ` Ranjani Sridharan
2020-05-19  4:18     ` Kuninori Morimoto
2020-05-19  1:02 ` [PATCH 6/7] ASoC: soc-link: add snd_soc_link_compr_shutdown() Kuninori Morimoto
2020-05-19  1:02 ` [PATCH 7/7] ASoC: soc-link: add snd_soc_link_compr_set_params() Kuninori Morimoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87367w68la.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.