Alsa-Devel Archive on lore.kernel.org
 help / color / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
	Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: Re: [alsa-devel] [PATCH 04/21] ASoC: soc-core: rename soc_init_dai_link() to soc_dai_link_sanity_check()
Date: Thu, 10 Oct 2019 09:17:56 -0500
Message-ID: <c594c9fd-1001-a50f-d6c2-06298a1c2110@linux.intel.com> (raw)
In-Reply-To: <87mueailrn.wl-kuninori.morimoto.gx@renesas.com>



On 10/8/19 11:30 PM, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> soc_init_dai_link() is checking dai_link only, not initializing today.
> Therefore, we can rename it as sanity_check.
> 
> And this check is for soc_bind_dai_link().
> Thus, we can check it under soc_bind_dai_link() to more clear code.
> This patch rename it, and call it from soc_bind_dai_link().
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   sound/soc/soc-core.c | 22 +++++++---------------
>   1 file changed, 7 insertions(+), 15 deletions(-)
> 
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 335dc8f..f440022 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -941,8 +941,8 @@ 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)
> +static int soc_dai_link_sanity_check(struct snd_soc_card *card,
> +				     struct snd_soc_dai_link *link)
>   {
>   	int i;
>   	struct snd_soc_dai_link_component *codec, *platform;
> @@ -1043,11 +1043,15 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
>   	struct snd_soc_pcm_runtime *rtd;
>   	struct snd_soc_dai_link_component *codec, *platform;
>   	struct snd_soc_component *component;
> -	int i;
> +	int i, ret;
>   
>   	if (dai_link->ignore)
>   		return 0;
>   
> +	ret = soc_dai_link_sanity_check(card, dai_link);
> +	if (ret < 0)
> +		return ret;
> +
>   	dev_dbg(card->dev, "ASoC: binding %s\n", dai_link->name);
>   
>   	if (soc_is_dai_link_bound(card, dai_link)) {
> @@ -1985,15 +1989,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
>   	int ret, i;
>   
>   	mutex_lock(&client_mutex);
> -	for_each_card_prelinks(card, i, dai_link) {
> -		ret = soc_init_dai_link(card, dai_link);
> -		if (ret) {
> -			dev_err(card->dev, "ASoC: failed to init link %s: %d\n",
> -				dai_link->name, ret);
> -			mutex_unlock(&client_mutex);
> -			return ret;
> -		}
> -	}

This part is difficult to understand.

There were two calls to soc_init_dai_link(), here and [2] below.
Your patch removes the first call and the for loop, is this intentional 
and needed?

>   	mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
>   
>   	snd_soc_dapm_init(&card->dapm, card, NULL);
> @@ -2073,9 +2068,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
>   		if (soc_is_dai_link_bound(card, dai_link))
>   			continue;
>   
> -		ret = soc_init_dai_link(card, dai_link);
> -		if (ret)
> -			goto probe_end;

[2]

>   		ret = soc_bind_dai_link(card, dai_link);
>   		if (ret)
>   			goto probe_end;
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply index

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-09  4:29 [alsa-devel] [PATCH 00/21] ASoC: soc-core cleanup - step 4 Kuninori Morimoto
2019-10-09  4:29 ` [alsa-devel] [PATCH 01/21] ASoC: soc-core: remove for_each_rtdcom_safe() Kuninori Morimoto
2019-10-09  4:29 ` [alsa-devel] [PATCH 02/21] ASoC: soc-core: add for_each_rtd_components() and replace Kuninori Morimoto
2019-10-09  4:30 ` [alsa-devel] [PATCH 03/21] ASoC: soc-core: move soc_init_dai_link() Kuninori Morimoto
2019-10-09  4:30 ` [alsa-devel] [PATCH 04/21] ASoC: soc-core: rename soc_init_dai_link() to soc_dai_link_sanity_check() Kuninori Morimoto
2019-10-10 14:17   ` Pierre-Louis Bossart [this message]
2019-10-11  1:19     ` Kuninori Morimoto
2019-10-11 13:38       ` Pierre-Louis Bossart
2019-10-09  4:30 ` [alsa-devel] [PATCH 05/21] ASoC: soc-core: remove duplicated soc_is_dai_link_bound() Kuninori Morimoto
2019-10-10 15:09   ` Pierre-Louis Bossart
2019-10-09  4:30 ` [alsa-devel] [PATCH 06/21] ASoC: soc-core: call soc_bind_dai_link() under snd_soc_add_dai_link() Kuninori Morimoto
2019-10-09  4:30 ` [alsa-devel] [PATCH 07/21] ASoC: soc-core: add soc_unbind_dai_link() Kuninori Morimoto
2019-10-09  4:30 ` [alsa-devel] [PATCH 08/21] ASoC: soc-core: snd_soc_unbind_card() cleanup Kuninori Morimoto
2019-10-09  4:30 ` [alsa-devel] [PATCH 09/21] ASoC: soc-core: remove unneeded snd_soc_tplg_component_remove() Kuninori Morimoto
2019-10-10 15:09   ` Pierre-Louis Bossart
2019-10-11  1:30     ` Kuninori Morimoto
2019-10-11 13:40       ` Pierre-Louis Bossart
2019-10-09  4:30 ` [alsa-devel] [PATCH 10/21] ASoC: soc-core: move snd_soc_lookup_component() Kuninori Morimoto
2019-10-09  4:30 ` [alsa-devel] [PATCH 11/21] ASoC: soc-core: add snd_soc_del_component() Kuninori Morimoto
2019-10-10 15:16   ` Pierre-Louis Bossart
2019-10-11  1:35     ` Kuninori Morimoto
2019-10-09  4:30 ` [alsa-devel] [PATCH 12/21] ASoC: soc-core: use snd_soc_lookup_component() at snd_soc_unregister_component() Kuninori Morimoto
2019-10-10 15:19   ` Pierre-Louis Bossart
2019-10-11  1:38     ` Kuninori Morimoto
2019-10-09  4:30 ` [alsa-devel] [PATCH 13/21] ASoC: soc-core: move snd_soc_register_dai() Kuninori Morimoto
2019-10-09  4:30 ` [alsa-devel] [PATCH 14/21] ASoC: soc-core: have legacy_dai_naming at snd_soc_register_dai() Kuninori Morimoto
2019-10-10 15:26   ` Pierre-Louis Bossart
2019-10-11  1:07     ` Kuninori Morimoto
2019-10-11 13:43       ` Pierre-Louis Bossart
2019-10-09  4:30 ` [alsa-devel] [PATCH 15/21] ASoC: soc-core: move snd_soc_unregister_dais() Kuninori Morimoto
2019-10-09  4:31 ` [alsa-devel] [PATCH 16/21] ASoC: soc-core: add snd_soc_unregister_dai() Kuninori Morimoto
2019-10-09  4:31 ` [alsa-devel] [PATCH 17/21] ASoC: soc-core: don't call snd_soc_dapm_new_dai_widgets() at snd_soc_register_dai() Kuninori Morimoto
2019-10-09  4:31 ` [alsa-devel] [PATCH 18/21] ASoC: soc-core: use mutex_lock() at snd_soc_add_component() Kuninori Morimoto
2019-10-10 15:29   ` Pierre-Louis Bossart
2019-10-09  4:31 ` [alsa-devel] [PATCH 19/21] ASoC: soc-core: call snd_soc_register_dai() from snd_soc_register_dais() Kuninori Morimoto
2019-10-10 15:34   ` Pierre-Louis Bossart
2019-10-11  1:44     ` Kuninori Morimoto
2019-10-09  4:31 ` [alsa-devel] [PATCH 20/21] ASoC: soc-core: remove topology specific operation Kuninori Morimoto
2019-10-09  4:31 ` [alsa-devel] [PATCH 21/21] ASoC: soc.h: dobj is used only when SND_SOC_TOPOLOGY Kuninori Morimoto
2019-10-09 14:16 ` [alsa-devel] [PATCH 00/21] ASoC: soc-core cleanup - step 4 Pierre-Louis Bossart
2019-10-10 15:38 ` Pierre-Louis Bossart
2019-10-11  1:53   ` Kuninori Morimoto

Reply instructions:

You may reply publically 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=c594c9fd-1001-a50f-d6c2-06298a1c2110@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    /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

Alsa-Devel Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/alsa-devel/0 alsa-devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 alsa-devel alsa-devel/ https://lore.kernel.org/alsa-devel \
		alsa-devel@alsa-project.org
	public-inbox-index alsa-devel

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.alsa-project.alsa-devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git