diff mbox series

[8/8] ASoC: cleanup function parameter for rtd and its id

Message ID 87plnqb84p.wl-kuninori.morimoto.gx@renesas.com
State New
Headers show
Series ASoC: cleasnup rtd and its ID | expand

Commit Message

Kuninori Morimoto Oct. 24, 2024, 1:29 a.m. UTC
some functions had parameter like below

	xxx(..., rtd, ..., id);

This "id" is rtd->id. We don't need to have "id" on each functions
because we can get it from "rtd". Let's cleanup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-dai.h  |  5 ++---
 include/sound/soc.h      |  6 +++---
 sound/soc/soc-compress.c |  9 ++++-----
 sound/soc/soc-core.c     |  8 +++-----
 sound/soc/soc-dai.c      |  4 ++--
 sound/soc/soc-pcm.c      | 16 ++++++++--------
 6 files changed, 22 insertions(+), 26 deletions(-)
diff mbox series

Patch

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 9dbeedf6da13b..b275201b02f60 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -216,8 +216,7 @@  void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
 			  struct snd_pcm_substream *substream, int rollback);
 void snd_soc_dai_suspend(struct snd_soc_dai *dai);
 void snd_soc_dai_resume(struct snd_soc_dai *dai);
-int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
-			     struct snd_soc_pcm_runtime *rtd, int id);
+int snd_soc_dai_compress_new(struct snd_soc_dai *dai, struct snd_soc_pcm_runtime *rtd);
 bool snd_soc_dai_stream_valid(const struct snd_soc_dai *dai, int stream);
 void snd_soc_dai_action(struct snd_soc_dai *dai,
 			int stream, int action);
@@ -275,7 +274,7 @@  struct snd_soc_dai_ops {
 	int (*probe)(struct snd_soc_dai *dai);
 	int (*remove)(struct snd_soc_dai *dai);
 	/* compress dai */
-	int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int id);
+	int (*compress_new)(struct snd_soc_pcm_runtime *rtd);
 	/* Optional Callback used at pcm creation*/
 	int (*pcm_new)(struct snd_soc_pcm_runtime *rtd,
 		       struct snd_soc_dai *dai);
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 828ab19258f0a..30a9d1853dc18 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -486,11 +486,11 @@  struct snd_soc_component *snd_soc_lookup_component_nolocked(struct device *dev,
 struct snd_soc_component *snd_soc_lookup_component(struct device *dev,
 						   const char *driver_name);
 
-int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int id);
+int soc_new_pcm(struct snd_soc_pcm_runtime *rtd);
 #ifdef CONFIG_SND_SOC_COMPRESS
-int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id);
+int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd);
 #else
-static inline int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id)
+static inline int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd)
 {
 	return 0;
 }
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index fb664c775dda5..3c514703fa33d 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -537,11 +537,10 @@  static struct snd_compr_ops soc_compr_dyn_ops = {
  * snd_soc_new_compress - create a new compress.
  *
  * @rtd: The runtime for which we will create compress
- * @id: the device index number (zero based - shared with normal PCMs)
  *
  * Return: 0 for success, else error.
  */
-int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id)
+int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_component *component;
 	struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
@@ -617,7 +616,7 @@  int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id)
 		snprintf(new_name, sizeof(new_name), "(%s)",
 			rtd->dai_link->stream_name);
 
-		ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, id,
+		ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, rtd->id,
 				playback, capture, &be_pcm);
 		if (ret < 0) {
 			dev_err(rtd->card->dev,
@@ -638,7 +637,7 @@  int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id)
 		memcpy(compr->ops, &soc_compr_dyn_ops, sizeof(soc_compr_dyn_ops));
 	} else {
 		snprintf(new_name, sizeof(new_name), "%s %s-%d",
-			rtd->dai_link->stream_name, codec_dai->name, id);
+			rtd->dai_link->stream_name, codec_dai->name, rtd->id);
 
 		memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops));
 	}
@@ -652,7 +651,7 @@  int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int id)
 		break;
 	}
 
-	ret = snd_compress_new(rtd->card->snd_card, id, direction,
+	ret = snd_compress_new(rtd->card->snd_card, rtd->id, direction,
 				new_name, compr);
 	if (ret < 0) {
 		component = snd_soc_rtd_to_codec(rtd, 0)->component;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4f0bfe73fe15e..a1dace4bb6166 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1479,7 +1479,7 @@  static int soc_init_pcm_runtime(struct snd_soc_card *card,
 {
 	struct snd_soc_dai_link *dai_link = rtd->dai_link;
 	struct snd_soc_dai *cpu_dai = snd_soc_rtd_to_cpu(rtd, 0);
-	int ret, id;
+	int ret;
 
 	/* do machine specific initialization */
 	ret = snd_soc_link_init(rtd);
@@ -1494,15 +1494,13 @@  static int soc_init_pcm_runtime(struct snd_soc_card *card,
 	/* add DPCM sysfs entries */
 	soc_dpcm_debugfs_add(rtd);
 
-	id = rtd->id;
-
 	/* create compress_device if possible */
-	ret = snd_soc_dai_compress_new(cpu_dai, rtd, id);
+	ret = snd_soc_dai_compress_new(cpu_dai, rtd);
 	if (ret != -ENOTSUPP)
 		goto err;
 
 	/* create the pcm */
-	ret = soc_new_pcm(rtd, id);
+	ret = soc_new_pcm(rtd);
 	if (ret < 0) {
 		dev_err(card->dev, "ASoC: can't create pcm %s :%d\n",
 			dai_link->stream_name, ret);
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
index 2feb76bf57bb7..34ba1a93a4c95 100644
--- a/sound/soc/soc-dai.c
+++ b/sound/soc/soc-dai.c
@@ -457,12 +457,12 @@  void snd_soc_dai_shutdown(struct snd_soc_dai *dai,
 }
 
 int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
-			     struct snd_soc_pcm_runtime *rtd, int id)
+			     struct snd_soc_pcm_runtime *rtd)
 {
 	int ret = -ENOTSUPP;
 	if (dai->driver->ops &&
 	    dai->driver->ops->compress_new)
-		ret = dai->driver->ops->compress_new(rtd, id);
+		ret = dai->driver->ops->compress_new(rtd);
 	return soc_dai_ret(dai, ret);
 }
 
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 81b63e547a099..fb7f25fd8ec5b 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2891,7 +2891,7 @@  static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd,
 
 static int soc_create_pcm(struct snd_pcm **pcm,
 			  struct snd_soc_pcm_runtime *rtd,
-			  int playback, int capture, int id)
+			  int playback, int capture)
 {
 	char new_name[64];
 	int ret;
@@ -2901,13 +2901,13 @@  static int soc_create_pcm(struct snd_pcm **pcm,
 		snprintf(new_name, sizeof(new_name), "codec2codec(%s)",
 			 rtd->dai_link->stream_name);
 
-		ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, id,
+		ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, rtd->id,
 					   playback, capture, pcm);
 	} else if (rtd->dai_link->no_pcm) {
 		snprintf(new_name, sizeof(new_name), "(%s)",
 			rtd->dai_link->stream_name);
 
-		ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, id,
+		ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, rtd->id,
 				playback, capture, pcm);
 	} else {
 		if (rtd->dai_link->dynamic)
@@ -2916,9 +2916,9 @@  static int soc_create_pcm(struct snd_pcm **pcm,
 		else
 			snprintf(new_name, sizeof(new_name), "%s %s-%d",
 				rtd->dai_link->stream_name,
-				soc_codec_dai_name(rtd), id);
+				soc_codec_dai_name(rtd), rtd->id);
 
-		ret = snd_pcm_new(rtd->card->snd_card, new_name, id, playback,
+		ret = snd_pcm_new(rtd->card->snd_card, new_name, rtd->id, playback,
 			capture, pcm);
 	}
 	if (ret < 0) {
@@ -2926,13 +2926,13 @@  static int soc_create_pcm(struct snd_pcm **pcm,
 			new_name, rtd->dai_link->name, ret);
 		return ret;
 	}
-	dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n", id, new_name);
+	dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n", rtd->id, new_name);
 
 	return 0;
 }
 
 /* create a new pcm */
-int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int id)
+int soc_new_pcm(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_component *component;
 	struct snd_pcm *pcm;
@@ -2943,7 +2943,7 @@  int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int id)
 	if (ret < 0)
 		return ret;
 
-	ret = soc_create_pcm(&pcm, rtd, playback, capture, id);
+	ret = soc_create_pcm(&pcm, rtd, playback, capture);
 	if (ret < 0)
 		return ret;