Linux Sound subsystem development
 help / color / mirror / Atom feed
From: "Alvin Šipraga" <alvin.sipraga@analog.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Mark Brown <broonie@kernel.org>, linux-sound@vger.kernel.org
Subject: Re: [PATCH 07/14] ASoC: soc-component: move soc_{probe/remove}_component() to soc-component.c
Date: Tue, 29 Sep 2026 10:24:40 +0200	[thread overview]
Message-ID: <art0TqnGvw7Ci21C@analog.com> (raw)
In-Reply-To: <87fqyseiat.wl-kuninori.morimoto.gx@renesas.com>

On Tue, Sep 29, 2026 at 05:30:02AM +0000, Kuninori Morimoto wrote:
> struct snd_soc_component will be capsuled soon, its member will not be
> able to access from non soc-component.c.
> 
> Move soc_{probe/remove}_component() to soc-component.c
> 
> It renames function name
> -	soc_{probe/remove}_component()
> +	snd_soc_component_{probe/remove}()
> 
> Then soc-component.c had original snd_soc_component_{probe/remove}() which
> is wrapper function. These wil be deployed internally.
> 
> Releted fucntions also be moved. It renames function name.
> 	soc_set_name_prefix()		-> snd_soc_component_set_name_prefix()
> 	soc_init_component_debugfs()	-> snd_soc_component_debugfs_init()
> 	soc_cleanup_component_debugfs()	-> snd_soc_component_debugfs_cleanup()
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---

Looks good, one minor improvement you might care to make if you send a v2.

>  include/sound/soc-component.h |   2 -
>  sound/soc/soc-component.c     | 191 +++++++++++++++++++++++++++++++---
>  sound/soc/soc-core.c          | 179 +------------------------------
>  sound/soc/soc-internal.h      |   2 +
>  4 files changed, 181 insertions(+), 193 deletions(-)
> 
> diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
> index 7708d84af8853..f2dccd3c9ca8e 100644
> --- a/include/sound/soc-component.h
> +++ b/include/sound/soc-component.h
> @@ -404,8 +404,6 @@ int snd_soc_component_close(struct snd_soc_component *component,
>  void snd_soc_component_suspend(struct snd_soc_component *component);
>  void snd_soc_component_resume(struct snd_soc_component *component);
>  int snd_soc_component_is_suspended(struct snd_soc_component *component);
> -int snd_soc_component_probe(struct snd_soc_component *component);
> -void snd_soc_component_remove(struct snd_soc_component *component);
>  int snd_soc_component_of_xlate_dai_id(struct snd_soc_component *component,
>  				      struct device_node *ep);
>  int snd_soc_component_of_xlate_dai_name(struct snd_soc_component *component,
> diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
> index 9622ad96d4691..78b348269707d 100644
> --- a/sound/soc/soc-component.c
> +++ b/sound/soc/soc-component.c

[...]

> +static void snd_soc_component_set_name_prefix(struct snd_soc_card *card,
> +					      struct snd_soc_component *component)

The card argument isn't actually needed here, since it's already
populated in the component struct below in
snd_soc_component_probe(). (See below). Maybe it can be dropped in
another patch.

> +{
> +	struct device_node *of_node = snd_soc_component_to_node(component);
> +	const char *str;
> +	int ret, i;
> +
> +	for (i = 0; i < card->num_configs; i++) {
> +		struct snd_soc_codec_conf *map = &card->codec_conf[i];
> +
> +		if (snd_soc_component_matches_dlc(component, &map->dlc) &&
> +		    map->name_prefix) {
> +			component->name_prefix = map->name_prefix;
> +			return;
> +		}
> +	}
> +
> +	/*
> +	 * If there is no configuration table or no match in the table,
> +	 * check if a prefix is provided in the node
> +	 */
> +	ret = of_property_read_string(of_node, "sound-name-prefix", &str);
> +	if (ret < 0)
> +		return;
> +
> +	component->name_prefix = str;
> +}

[...]

> +int snd_soc_component_probe(struct snd_soc_card *card, struct snd_soc_component *component)
> +{
> +	struct snd_soc_dapm_context *dapm = snd_soc_component_to_dapm(component);
> +	struct snd_soc_dai *dai;
> +	int probed = 0;
> +	int ret;
> +
> +	if (snd_soc_component_is_dummy(component))
> +		return 0;
> +
> +	if (component->card) {
> +		if (component->card != card) {
> +			dev_err(component->dev,
> +				"Trying to bind component \"%s\" to card \"%s\" "
> +				"but is already bound to card \"%s\"\n",
> +				component->name, card->name, component->card->name);
> +			return -ENODEV;
> +		}
> +		return 0;
> +	}
> +
> +	ret = snd_soc_component_module_get_when_probe(component);
> +	if (ret < 0)
> +		return ret;
> +
> +	component->card = card;
> +	snd_soc_component_set_name_prefix(card, component);

(Set here).

  reply	other threads:[~2026-09-29  8:24 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29  5:29 [PATCH 00/14] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Kuninori Morimoto
2026-09-29  5:29 ` [PATCH 01/14] ASoC: soc-component: tidyup be_hw_params_fixup() define position Kuninori Morimoto
2026-09-29  5:29 ` [PATCH 02/14] ASoC: soc-component: replace bool member to bit field Kuninori Morimoto
2026-09-29  5:29 ` [PATCH 03/14] ASoC: soc-component: move snd_soc_add_component_controls() Kuninori Morimoto
2026-09-29  5:29 ` [PATCH 04/14] ASoC: soc-component: move snd_soc_component_fixup_controls() Kuninori Morimoto
2026-09-29  5:29 ` [PATCH 05/14] ASoC: soc-component: move soc_component_to_node() to soc-component.c Kuninori Morimoto
2026-09-29  5:29 ` [PATCH 06/14] ASoC: soc-component: move snd_soc_is_matching_component() " Kuninori Morimoto
2026-09-29  5:30 ` [PATCH 07/14] ASoC: soc-component: move soc_{probe/remove}_component() " Kuninori Morimoto
2026-09-29  8:24   ` Alvin Šipraga [this message]
2026-09-29 23:36     ` Kuninori Morimoto
2026-09-29  5:30 ` [PATCH 08/14] ASoC: soc-component: move snd_soc_component_to_dapm() " Kuninori Morimoto
2026-09-29  5:30 ` [PATCH 09/14] ASoC: soc-component: move snd_soc_component_cache_sync() " Kuninori Morimoto
2026-09-29  5:30 ` [PATCH 10/14] ASoC: soc-component: move snd_soc_component_active() " Kuninori Morimoto
2026-09-29  5:30 ` [PATCH 11/14] ASoC: soc-component: move component_list " Kuninori Morimoto
2026-09-29  5:30 ` [PATCH 12/14] ASoC: soc-component: move snd_soc_lookup_component() " Kuninori Morimoto
2026-09-29  5:30 ` [PATCH 13/14] ASoC: soc-component: move __snd_soc_of_put_component() " Kuninori Morimoto
2026-09-29  5:30 ` [PATCH 14/14] ASoC: soc-component: rename snd_soc_component_async_complete() Kuninori Morimoto
2026-09-29  8:25 ` [PATCH 00/14] ASoC: soc-component: move snd_soc_component_xxx() to soc-component.c Alvin Šipraga

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=art0TqnGvw7Ci21C@analog.com \
    --to=alvin.sipraga@analog.com \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --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