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: [alsa-devel] [PATCH v2 resend 02/18] ASoC: soc-core: move soc_init_dai_link()
Date: 30 Oct 2019 10:26:22 +0900	[thread overview]
Message-ID: <871ruvdnwh.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <874kzrdo1x.wl-kuninori.morimoto.gx@renesas.com>


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

This patch moves soc_init_dai_link() next to soc_bind_dai_link().
This is prepare for soc_bind_dai_link() cleanup.

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

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index b07ecfa..a141828 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -941,6 +941,102 @@ static bool soc_is_dai_link_bound(struct snd_soc_card *card,
 	return false;
 }
 
+static int soc_init_dai_link(struct snd_soc_card *card,
+			     struct snd_soc_dai_link *link)
+{
+	int i;
+	struct snd_soc_dai_link_component *codec, *platform;
+
+	for_each_link_codecs(link, i, codec) {
+		/*
+		 * Codec must be specified by 1 of name or OF node,
+		 * not both or neither.
+		 */
+		if (!!codec->name == !!codec->of_node) {
+			dev_err(card->dev, "ASoC: Neither/both codec name/of_node are set for %s\n",
+				link->name);
+			return -EINVAL;
+		}
+
+		/* Codec DAI name must be specified */
+		if (!codec->dai_name) {
+			dev_err(card->dev, "ASoC: codec_dai_name not set for %s\n",
+				link->name);
+			return -EINVAL;
+		}
+
+		/*
+		 * Defer card registration if codec component is not added to
+		 * component list.
+		 */
+		if (!soc_find_component(codec))
+			return -EPROBE_DEFER;
+	}
+
+	for_each_link_platforms(link, i, platform) {
+		/*
+		 * Platform may be specified by either name or OF node, but it
+		 * can be left unspecified, then no components will be inserted
+		 * in the rtdcom list
+		 */
+		if (!!platform->name == !!platform->of_node) {
+			dev_err(card->dev,
+				"ASoC: Neither/both platform name/of_node are set for %s\n",
+				link->name);
+			return -EINVAL;
+		}
+
+		/*
+		 * Defer card registration if platform component is not added to
+		 * component list.
+		 */
+		if (!soc_find_component(platform))
+			return -EPROBE_DEFER;
+	}
+
+	/* FIXME */
+	if (link->num_cpus > 1) {
+		dev_err(card->dev,
+			"ASoC: multi cpu is not yet supported %s\n",
+			link->name);
+		return -EINVAL;
+	}
+
+	/*
+	 * CPU device may be specified by either name or OF node, but
+	 * can be left unspecified, and will be matched based on DAI
+	 * name alone..
+	 */
+	if (link->cpus->name && link->cpus->of_node) {
+		dev_err(card->dev,
+			"ASoC: Neither/both cpu name/of_node are set for %s\n",
+			link->name);
+		return -EINVAL;
+	}
+
+	/*
+	 * Defer card registartion if cpu dai component is not added to
+	 * component list.
+	 */
+	if ((link->cpus->of_node || link->cpus->name) &&
+	    !soc_find_component(link->cpus))
+		return -EPROBE_DEFER;
+
+	/*
+	 * At least one of CPU DAI name or CPU device name/node must be
+	 * specified
+	 */
+	if (!link->cpus->dai_name &&
+	    !(link->cpus->name || link->cpus->of_node)) {
+		dev_err(card->dev,
+			"ASoC: Neither cpu_dai_name nor cpu_name/of_node are set for %s\n",
+			link->name);
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
 static int soc_bind_dai_link(struct snd_soc_card *card,
 	struct snd_soc_dai_link *dai_link)
 {
@@ -1283,102 +1379,6 @@ static int soc_probe_link_components(struct snd_soc_card *card)
 	return 0;
 }
 
-static int soc_init_dai_link(struct snd_soc_card *card,
-			     struct snd_soc_dai_link *link)
-{
-	int i;
-	struct snd_soc_dai_link_component *codec, *platform;
-
-	for_each_link_codecs(link, i, codec) {
-		/*
-		 * Codec must be specified by 1 of name or OF node,
-		 * not both or neither.
-		 */
-		if (!!codec->name == !!codec->of_node) {
-			dev_err(card->dev, "ASoC: Neither/both codec name/of_node are set for %s\n",
-				link->name);
-			return -EINVAL;
-		}
-
-		/* Codec DAI name must be specified */
-		if (!codec->dai_name) {
-			dev_err(card->dev, "ASoC: codec_dai_name not set for %s\n",
-				link->name);
-			return -EINVAL;
-		}
-
-		/*
-		 * Defer card registration if codec component is not added to
-		 * component list.
-		 */
-		if (!soc_find_component(codec))
-			return -EPROBE_DEFER;
-	}
-
-	for_each_link_platforms(link, i, platform) {
-		/*
-		 * Platform may be specified by either name or OF node, but it
-		 * can be left unspecified, then no components will be inserted
-		 * in the rtdcom list
-		 */
-		if (!!platform->name == !!platform->of_node) {
-			dev_err(card->dev,
-				"ASoC: Neither/both platform name/of_node are set for %s\n",
-				link->name);
-			return -EINVAL;
-		}
-
-		/*
-		 * Defer card registration if platform component is not added to
-		 * component list.
-		 */
-		if (!soc_find_component(platform))
-			return -EPROBE_DEFER;
-	}
-
-	/* FIXME */
-	if (link->num_cpus > 1) {
-		dev_err(card->dev,
-			"ASoC: multi cpu is not yet supported %s\n",
-			link->name);
-		return -EINVAL;
-	}
-
-	/*
-	 * CPU device may be specified by either name or OF node, but
-	 * can be left unspecified, and will be matched based on DAI
-	 * name alone..
-	 */
-	if (link->cpus->name && link->cpus->of_node) {
-		dev_err(card->dev,
-			"ASoC: Neither/both cpu name/of_node are set for %s\n",
-			link->name);
-		return -EINVAL;
-	}
-
-	/*
-	 * Defer card registartion if cpu dai component is not added to
-	 * component list.
-	 */
-	if ((link->cpus->of_node || link->cpus->name) &&
-	    !soc_find_component(link->cpus))
-		return -EPROBE_DEFER;
-
-	/*
-	 * At least one of CPU DAI name or CPU device name/node must be
-	 * specified
-	 */
-	if (!link->cpus->dai_name &&
-	    !(link->cpus->name || link->cpus->of_node)) {
-		dev_err(card->dev,
-			"ASoC: Neither cpu_dai_name nor cpu_name/of_node are set for %s\n",
-			link->name);
-		return -EINVAL;
-	}
-
-	return 0;
-}
-
 void snd_soc_disconnect_sync(struct device *dev)
 {
 	struct snd_soc_component *component =
-- 
2.7.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2019-10-30  1:28 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-30  1:23 [alsa-devel] [PATCH v2 resend 00/18] ASoC: soc-core cleanup - step 4 Kuninori Morimoto
2019-10-30  1:26 ` [alsa-devel] [PATCH v2 resend 01/18] ASoC: soc-core: remove unneeded snd_soc_tplg_component_remove() Kuninori Morimoto
2019-10-30 12:57   ` [alsa-devel] Applied "ASoC: soc-core: remove unneeded snd_soc_tplg_component_remove()" to the asoc tree Mark Brown
2019-11-05  2:55   ` [alsa-devel] [PATCH v2 resend 01/18] ASoC: soc-core: remove unneeded snd_soc_tplg_component_remove() Sridharan, Ranjani
2019-11-05  4:02     ` Kuninori Morimoto
2019-10-30  1:26 ` Kuninori Morimoto [this message]
2019-11-05  2:02   ` [alsa-devel] [PATCH v2 resend 02/18] ASoC: soc-core: move soc_init_dai_link() Pierre-Louis Bossart
2019-11-05  4:09     ` Kuninori Morimoto
2019-10-30  1:26 ` [alsa-devel] [PATCH v2 resend 03/18] ASoC: soc-core: tidyup soc_init_dai_link() Kuninori Morimoto
2019-11-05  3:02   ` Ranjani Sridharan
2019-11-05  4:19     ` Kuninori Morimoto
2019-11-05  5:22       ` Sridharan, Ranjani
2019-11-05  5:35         ` Kuninori Morimoto
2019-10-30  1:26 ` [alsa-devel] [PATCH v2 resend 04/18] ASoC: soc-core: remove duplicated soc_is_dai_link_bound() Kuninori Morimoto
2019-10-30  1:26 ` [alsa-devel] [PATCH v2 resend 05/18] ASoC: soc-core: call soc_bind_dai_link() under snd_soc_add_dai_link() Kuninori Morimoto
2019-10-30  1:26 ` [alsa-devel] [PATCH v2 resend 06/18] ASoC: soc-core: add soc_unbind_dai_link() Kuninori Morimoto
2019-10-30  1:26 ` [alsa-devel] [PATCH v2 resend 07/18] ASoC: soc-core: move snd_soc_lookup_component() Kuninori Morimoto
2019-11-05  2:22   ` Pierre-Louis Bossart
2019-11-05  4:10     ` Kuninori Morimoto
2019-10-30  1:26 ` [alsa-devel] [PATCH v2 resend 08/18] ASoC: soc-core: add snd_soc_del_component_unlocked() Kuninori Morimoto
2019-10-30  1:26 ` [alsa-devel] [PATCH v2 resend 09/18] ASoC: soc-core: remove snd_soc_component_add/del() Kuninori Morimoto
2019-10-30  1:26 ` [alsa-devel] [PATCH v2 resend 10/18] ASoC: soc-core: use snd_soc_lookup_component() at snd_soc_unregister_component() Kuninori Morimoto
2019-10-30  1:27 ` [alsa-devel] [PATCH v2 resend 11/18] ASoC: soc-core: move snd_soc_register_dai() Kuninori Morimoto
2019-10-30  1:27 ` [alsa-devel] [PATCH v2 resend 12/18] ASoC: soc-core: move snd_soc_unregister_dais() Kuninori Morimoto
2019-10-30  1:27 ` [alsa-devel] [PATCH v2 resend 13/18] ASoC: soc-core: add snd_soc_unregister_dai() Kuninori Morimoto
2019-10-30  1:27 ` [alsa-devel] [PATCH v2 resend 14/18] ASoC: soc-core: have legacy_dai_naming at snd_soc_register_dai() Kuninori Morimoto
2019-10-30  1:27 ` [alsa-devel] [PATCH v2 resend 15/18] ASoC: soc-core: don't call snd_soc_dapm_new_dai_widgets() " Kuninori Morimoto
2019-11-05  3:20   ` Ranjani Sridharan
2019-11-05  4:20     ` Kuninori Morimoto
2019-10-30  1:27 ` [alsa-devel] [PATCH v2 resend 16/18] ASoC: soc-core: call snd_soc_register_dai() from snd_soc_register_dais() Kuninori Morimoto
2019-10-30  1:27 ` [alsa-devel] [PATCH v2 resend 17/18] ASoC: soc-core: remove topology specific operation Kuninori Morimoto
2019-10-30  1:27 ` [alsa-devel] [PATCH v2 resend 18/18] ASoC: soc.h: dobj is used only when SND_SOC_TOPOLOGY Kuninori Morimoto
2019-10-30 11:34 ` [alsa-devel] [PATCH v2 resend 00/18] ASoC: soc-core cleanup - step 4 Mark Brown
2019-10-31  0:46   ` Kuninori Morimoto
2019-11-05  2:38 ` Pierre-Louis Bossart
2019-11-05  4:08   ` 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=871ruvdnwh.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.