Linux Sound subsystem development
 help / color / mirror / Atom feed
From: "Rojewski, Cezary" <cezary.rojewski@intel.com>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: <linux-sound@vger.kernel.org>, Mark Brown <broonie@kernel.org>
Subject: Re: [PATCH 2/2] ASoC: soc-core: handle card->list in snd_soc_unbind_card()
Date: Wed, 13 May 2026 22:46:44 +0200	[thread overview]
Message-ID: <a9542a23-7a9d-481a-b93e-04f1961e9647@intel.com> (raw)
In-Reply-To: <87wlx85bb3.wl-kuninori.morimoto.gx@renesas.com>

On 5/13/2026 3:48 AM, Kuninori Morimoto wrote:
> snd_soc_bind_card()   is handling card->list inside, but
> snd_soc_unbind_card() is handling it in outside.
> Let's handle it inside.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   sound/soc/soc-core.c | 19 ++++++++++---------
>   1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index ae8467d88978e..8b2269ba67c3a 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -1990,12 +1990,18 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card)
>   	}
>   }
>   
> -static void snd_soc_unbind_card(struct snd_soc_card *card)
> +static void snd_soc_unbind_card(struct snd_soc_card *card, bool add_to_list)
>   {
>   	if (snd_soc_card_is_instantiated(card)) {
>   		card->instantiated = false;
>   		soc_cleanup_card_resources(card);
> +
> +		if (add_to_list)
> +			list_add(&card->list, &unbind_card_list);

I see benefit in this.

>   	}
> +
> +	if (!add_to_list)
> +		list_del(&card->list);

But not this.

Moving card-behavior code from component-related function to 
card-related one seems intuitive.  However, snd_soc_unregister_card() is 
already card-lated function.  I'd keep the list_del() there and avoid 
the second if-statement.

>   }
>   
>   static int snd_soc_bind_card(struct snd_soc_card *card)
> @@ -2439,8 +2445,7 @@ void snd_soc_unregister_card(struct snd_soc_card *card)
>   {
>   	guard(mutex)(&client_mutex);
>   
> -	snd_soc_unbind_card(card);
> -	list_del(&card->list);
> +	snd_soc_unbind_card(card, false);
>   
>   	dev_dbg(card->dev, "ASoC: Unregistered card '%s'\n", card->name);
>   }
> @@ -2667,12 +2672,8 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component)
>   
>   	snd_soc_unregister_dais(component);
>   
> -	if (card) {
> -		instantiated = card->instantiated;
> -		snd_soc_unbind_card(card);
> -		if (instantiated)
> -			list_add(&card->list, &unbind_card_list);
> -	}
> +	if (card)
> +		snd_soc_unbind_card(card, true);
>   
>   	list_del(&component->list);
>   }


  reply	other threads:[~2026-05-13 20:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-13  1:48 [PATCH 0/2] ASoC: tidyup card rebind functions Kuninori Morimoto
2026-05-13  1:48 ` [PATCH 1/2] ASoC: soc-core: add soc_rebind_card() Kuninori Morimoto
2026-05-13 21:01   ` Rojewski, Cezary
2026-05-13 23:36     ` Kuninori Morimoto
2026-05-13  1:48 ` [PATCH 2/2] ASoC: soc-core: handle card->list in snd_soc_unbind_card() Kuninori Morimoto
2026-05-13 20:46   ` Rojewski, Cezary [this message]
2026-05-14  0:04     ` 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=a9542a23-7a9d-481a-b93e-04f1961e9647@intel.com \
    --to=cezary.rojewski@intel.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