Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: "Mark Brown" <broonie@kernel.org>,
	"Alvin Šipraga" <alvin.sipraga@analog.com>
Cc: linux-sound@vger.kernel.org
Subject: [PATCH v2 06/13] ASoC: soc-component: move snd_soc_is_matching_component() to soc-component.c
Date: Fri, 2 Oct 2026 02:51:56 +0000	[thread overview]
Message-ID: <87ece86chf.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87mrsw6cje.wl-kuninori.morimoto.gx@renesas.com>

struct snd_soc_component will be capsuled soon, its member will not be
able to access from non soc-component.c.

Move snd_soc_is_matching_component() to soc-component.c

It renames function name
-	snd_soc_is_matching_component()
+	snd_soc_component_matches_dlc()

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Alvin Šipraga <alvin.sipraga@analog.com>
---
 sound/soc/soc-component.c | 27 +++++++++++++++++++++++++++
 sound/soc/soc-core.c      | 36 ++++--------------------------------
 sound/soc/soc-internal.h  |  3 ++-
 3 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index 11acf0d42213f..9622ad96d4691 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -1306,3 +1306,30 @@ struct device_node *snd_soc_component_to_node(struct snd_soc_component *componen
 
 	return of_node;
 }
+
+bool snd_soc_component_matches_dlc(struct snd_soc_component *component,
+				   const struct snd_soc_dai_link_component *dlc)
+{
+	struct device_node *component_of_node;
+
+	if (!dlc)
+		return false;
+
+	if (dlc->dai_args) {
+		struct snd_soc_dai *dai;
+
+		for_each_component_dais(component, dai)
+			if (snd_soc_dai_matches_dlc(dai, dlc))
+				return true;
+		return false;
+	}
+
+	component_of_node = snd_soc_component_to_node(component);
+
+	if (dlc->of_node && component_of_node != dlc->of_node)
+		return false;
+	if (dlc->name && strcmp(component->name, dlc->name))
+		return false;
+
+	return true;
+}
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 59a8f44e249a3..11e25ac7235f2 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -785,34 +785,6 @@ struct of_phandle_args *snd_soc_copy_dai_args(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(snd_soc_copy_dai_args);
 
-static int snd_soc_is_matching_component(
-	const struct snd_soc_dai_link_component *dlc,
-	struct snd_soc_component *component)
-{
-	struct device_node *component_of_node;
-
-	if (!dlc)
-		return 0;
-
-	if (dlc->dai_args) {
-		struct snd_soc_dai *dai;
-
-		for_each_component_dais(component, dai)
-			if (snd_soc_dai_matches_dlc(dai, dlc))
-				return 1;
-		return 0;
-	}
-
-	component_of_node = snd_soc_component_to_node(component);
-
-	if (dlc->of_node && component_of_node != dlc->of_node)
-		return 0;
-	if (dlc->name && strcmp(component->name, dlc->name))
-		return 0;
-
-	return 1;
-}
-
 static struct snd_soc_component *soc_find_component(
 	const struct snd_soc_dai_link_component *dlc)
 {
@@ -829,7 +801,7 @@ static struct snd_soc_component *soc_find_component(
 	 *	CPU component and generic DMAEngine component
 	 */
 	for_each_component(component)
-		if (snd_soc_is_matching_component(dlc, component))
+		if (snd_soc_component_matches_dlc(component, dlc))
 			return component;
 
 	return NULL;
@@ -856,7 +828,7 @@ struct snd_soc_dai *snd_soc_find_dai(
 
 	/* Find CPU DAI from registered DAIs */
 	for_each_component(component)
-		if (snd_soc_is_matching_component(dlc, component))
+		if (snd_soc_component_matches_dlc(component, dlc))
 			for_each_component_dais(component, dai)
 				if (snd_soc_dai_matches_dlc(dai, dlc))
 					return dai;
@@ -1155,7 +1127,7 @@ static int snd_soc_add_pcm_runtime(struct snd_soc_card *card,
 	/* Find PLATFORM from registered PLATFORMs */
 	for_each_link_platforms(dai_link, i, platform) {
 		for_each_component(component) {
-			if (!snd_soc_is_matching_component(platform, component))
+			if (!snd_soc_component_matches_dlc(component, platform))
 				continue;
 
 			if (snd_soc_component_is_dummy(component) && component->num_dai)
@@ -1334,7 +1306,7 @@ static void soc_set_name_prefix(struct snd_soc_card *card,
 	for (i = 0; i < card->num_configs; i++) {
 		struct snd_soc_codec_conf *map = &card->codec_conf[i];
 
-		if (snd_soc_is_matching_component(&map->dlc, component) &&
+		if (snd_soc_component_matches_dlc(component, &map->dlc) &&
 		    map->name_prefix) {
 			component->name_prefix = map->name_prefix;
 			return;
diff --git a/sound/soc/soc-internal.h b/sound/soc/soc-internal.h
index a08e6e8ef17f3..76353d52ce971 100644
--- a/sound/soc/soc-internal.h
+++ b/sound/soc/soc-internal.h
@@ -40,6 +40,7 @@ void snd_soc_dai_active_update(struct snd_soc_dai *dai, int stream, int action);
  * In soc-component
  */
 struct device_node *snd_soc_component_to_node(struct snd_soc_component *component);
-
+bool snd_soc_component_matches_dlc(struct snd_soc_component *component,
+				   const struct snd_soc_dai_link_component *dlc);
 
 #endif /* __SOC_INTERNAL_H */
-- 
2.53.0


  parent reply	other threads:[~2026-10-02  2:51 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02  2:50 [PATCH v2 00/13] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
2026-10-02  2:51 ` [PATCH v2 01/13] ASoC: soc-component: tidyup be_hw_params_fixup() define position Kuninori Morimoto
2026-10-02  2:51 ` [PATCH v2 02/13] ASoC: soc-component: replace bool member to bit field Kuninori Morimoto
2026-10-02  2:51 ` [PATCH v2 03/13] ASoC: soc-component: move snd_soc_add_component_controls() Kuninori Morimoto
2026-10-02  2:51 ` [PATCH v2 04/13] ASoC: soc-component: move snd_soc_component_fixup_controls() Kuninori Morimoto
2026-10-02  2:51 ` [PATCH v2 05/13] ASoC: soc-component: move soc_component_to_node() to soc-component.c Kuninori Morimoto
2026-10-02  2:51 ` Kuninori Morimoto [this message]
2026-10-02  2:52 ` [PATCH v2 07/13] ASoC: soc-component: move soc_{probe/remove}_component() " Kuninori Morimoto
2026-10-04 21:52   ` Mark Brown
2026-10-02  2:52 ` [PATCH v2 08/13] ASoC: soc-component: move snd_soc_component_to_dapm() " Kuninori Morimoto
2026-10-02  2:52 ` [PATCH v2 09/13] ASoC: soc-component: move snd_soc_component_cache_sync() " Kuninori Morimoto
2026-10-02  2:52 ` [PATCH v2 10/13] ASoC: soc-component: move snd_soc_component_active() " Kuninori Morimoto
2026-10-02  2:52 ` [PATCH v2 11/13] ASoC: soc-component: move component_list " Kuninori Morimoto
2026-10-02  2:52 ` [PATCH v2 12/13] ASoC: soc-component: move snd_soc_lookup_component() " Kuninori Morimoto
2026-10-02  2:52 ` [PATCH v2 13/13] ASoC: soc-component: rename snd_soc_component_async_complete() 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=87ece86chf.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alvin.sipraga@analog.com \
    --cc=broonie@kernel.org \
    --cc=linux-sound@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox