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 5/7] ASoC: soc-core: Merge CPU/Codec for soc_dai_pcm_new()
Date: 11 Mar 2020 10:07:36 +0900	[thread overview]
Message-ID: <87r1xzvgvb.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87y2s7vgxb.wl-kuninori.morimoto.gx@renesas.com>


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

Now CPU/Codec DAIs are alias for dais.
Thus, we can directly use for_each_rtd_dais() macro
for soc_dai_pcm_new().
This patch merge CPU/Codec for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-core.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 333cbbd268b4..38c2b0434f8f 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1037,20 +1037,20 @@ int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
 }
 EXPORT_SYMBOL_GPL(snd_soc_add_pcm_runtime);
 
-static int soc_dai_pcm_new(struct snd_soc_dai **dais, int num_dais,
-			   struct snd_soc_pcm_runtime *rtd)
+static int soc_dai_pcm_new(struct snd_soc_pcm_runtime *rtd)
 {
+	struct snd_soc_dai *dai;
 	int i, ret = 0;
 
-	for (i = 0; i < num_dais; ++i) {
-		struct snd_soc_dai_driver *drv = dais[i]->driver;
+	for_each_rtd_dais(rtd, i, dai) {
+		struct snd_soc_dai_driver *drv = dai->driver;
 
 		if (drv->pcm_new)
-			ret = drv->pcm_new(rtd, dais[i]);
+			ret = drv->pcm_new(rtd, dai);
 		if (ret < 0) {
-			dev_err(dais[i]->dev,
+			dev_err(dai->dev,
 				"ASoC: Failed to bind %s with pcm device\n",
-				dais[i]->name);
+				dai->name);
 			return ret;
 		}
 	}
@@ -1121,13 +1121,8 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card,
 			dai_link->stream_name, ret);
 		return ret;
 	}
-	ret = soc_dai_pcm_new(rtd->cpu_dais,
-			      rtd->num_cpus, rtd);
-	if (ret < 0)
-		return ret;
-	ret = soc_dai_pcm_new(rtd->codec_dais,
-			      rtd->num_codecs, rtd);
-	return ret;
+
+	return soc_dai_pcm_new(rtd);
 }
 
 static void soc_set_name_prefix(struct snd_soc_card *card,
-- 
2.17.1


  parent reply	other threads:[~2020-03-11  1:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-11  1:06 [PATCH 0/7] ASoC: Merge CPU/Codec DAIs Kuninori Morimoto
2020-03-11  1:07 ` [PATCH 1/7] ASoC: soc-core: " Kuninori Morimoto
2020-03-11  1:07 ` [PATCH 2/7] ASoC: soc-core: Merge for_each_rtd_cpu/codec_dais() Kuninori Morimoto
2020-03-11  1:07 ` [PATCH 3/7] ASoC: soc-dapm: " Kuninori Morimoto
2020-03-11  1:27   ` Sridharan, Ranjani
2020-03-11  1:30     ` Kuninori Morimoto
2020-03-11  1:07 ` [PATCH 4/7] ASoC: soc-pcm: " Kuninori Morimoto
2020-03-11  1:30   ` Sridharan, Ranjani
2020-03-11  2:06     ` Kuninori Morimoto
2020-03-11  1:07 ` Kuninori Morimoto [this message]
2020-03-11  1:07 ` [PATCH 6/7] ASoC: soc-pcm: Merge CPU/Codec MSB at soc_pcm_apply_msb() Kuninori Morimoto
2020-03-11  1:07 ` [PATCH 7/7] ASoC: soc-pcm: Merge CPU/Codec at soc_pcm_pointer() Kuninori Morimoto
2020-03-11  2:00   ` Pierre-Louis Bossart
2020-03-11  2:39     ` Kuninori Morimoto
2020-03-11  1:51 ` [PATCH 0/7] ASoC: Merge CPU/Codec DAIs Pierre-Louis Bossart
2020-03-11  2:27   ` Kuninori Morimoto
2020-03-11 14:36     ` Pierre-Louis Bossart
2020-03-11 17:10       ` Mark Brown
2020-03-12  1:17         ` 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=87r1xzvgvb.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.