Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / 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: [PATCH 12/19] ASoC: soc-card: add probed bit field to snd_soc_card
Date: Tue, 26 May 2020 09:08:05 -0500	[thread overview]
Message-ID: <9d5d8e40-c39e-5533-5ccc-8d79fafc1168@linux.intel.com> (raw)
In-Reply-To: <87zh9v1okl.wl-kuninori.morimoto.gx@renesas.com>



On 5/25/20 8:18 PM, Kuninori Morimoto wrote:
> 
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> We have bit field to control snd_soc_card.
> Let's add probed field on it instead of local variable.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>   include/sound/soc.h  |  1 +
>   sound/soc/soc-core.c | 18 ++++++++----------
>   2 files changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/include/sound/soc.h b/include/sound/soc.h
> index 060c01c32547..74868436ac79 100644
> --- a/include/sound/soc.h
> +++ b/include/sound/soc.h
> @@ -1096,6 +1096,7 @@ struct snd_soc_card {
>   	unsigned int topology_shortname_created:1;
>   	unsigned int fully_routed:1;
>   	unsigned int disable_route_checks:1;
> +	unsigned int probed:1;
>   
>   	void *drvdata;
>   };
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 02147acf6547..7cfb3ee6ff4f 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -1723,8 +1723,7 @@ static void __soc_setup_card_name(char *name, int len,
>   	}
>   }
>   
> -static void soc_cleanup_card_resources(struct snd_soc_card *card,
> -				       int card_probed)
> +static void soc_cleanup_card_resources(struct snd_soc_card *card)
>   {
>   	struct snd_soc_pcm_runtime *rtd, *n;
>   
> @@ -1748,8 +1747,9 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card,
>   	soc_cleanup_card_debugfs(card);
>   
>   	/* remove the card */
> -	if (card_probed && card->remove)
> +	if (card->probed && card->remove)
>   		card->remove(card);
> +	card->probed = 0;
>   
>   	if (card->snd_card) {
>   		snd_card_free(card->snd_card);
> @@ -1760,12 +1760,10 @@ static void soc_cleanup_card_resources(struct snd_soc_card *card,
>   static void snd_soc_unbind_card(struct snd_soc_card *card, bool unregister)
>   {
>   	if (card->instantiated) {
> -		int card_probed = 1;
> -

This looks like a change, now soc_cleanup_card_resources() is called 
without setting the card_probed bitfield?

everywhere else I see a 1:1 mapping between variable and bitfield usage, 
not here, is this intentional?

>   		card->instantiated = false;
>   		snd_soc_flush_all_delayed_work(card);
>   
> -		soc_cleanup_card_resources(card, card_probed);
> +		soc_cleanup_card_resources(card);
>   		if (!unregister)
>   			list_add(&card->list, &unbind_card_list);
>   	} else {
> @@ -1779,7 +1777,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
>   	struct snd_soc_pcm_runtime *rtd;
>   	struct snd_soc_component *component;
>   	struct snd_soc_dai_link *dai_link;
> -	int ret, i, card_probed = 0;
> +	int ret, i;
>   
>   	mutex_lock(&client_mutex);
>   	mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
> @@ -1831,7 +1829,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
>   		ret = card->probe(card);
>   		if (ret < 0)
>   			goto probe_end;
> -		card_probed = 1;
> +		card->probed = 1;
>   	}
>   
>   	/* probe all components used by DAI links on this card */
> @@ -1923,7 +1921,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
>   			goto probe_end;
>   		}
>   	}
> -	card_probed = 1;
> +	card->probed = 1;
>   
>   	snd_soc_dapm_new_widgets(card);
>   
> @@ -1945,7 +1943,7 @@ static int snd_soc_bind_card(struct snd_soc_card *card)
>   
>   probe_end:
>   	if (ret < 0)
> -		soc_cleanup_card_resources(card, card_probed);
> +		soc_cleanup_card_resources(card);
>   
>   	mutex_unlock(&card->mutex);
>   	mutex_unlock(&client_mutex);
> 

  reply	other threads:[~2020-05-26 15:37 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-26  1:15 [PATCH 00/19] ASoC: add soc-card Kuninori Morimoto
2020-05-26  1:16 ` [PATCH 01/19] ASoC: soc.h: convert bool to bit field for snd_soc_card Kuninori Morimoto
2020-05-26  1:16 ` [PATCH 02/19] ASoC: add soc-card.c Kuninori Morimoto
2020-05-27  0:26   ` Ranjani Sridharan
2020-05-28  0:03     ` Kuninori Morimoto
2020-05-28  0:35       ` Kuninori Morimoto
2020-05-26  1:16 ` [PATCH 03/19] ASoC: soc-card: move snd_soc_card_get_kcontrol() to soc-card Kuninori Morimoto
2020-05-26  1:16 ` [PATCH 04/19] ASoC: soc-card: move snd_soc_card_jack_new() " Kuninori Morimoto
2020-05-26  1:17 ` [PATCH 05/19] ASoC: soc-card: move snd_soc_card_set/get_drvdata() " Kuninori Morimoto
2020-05-26  1:17 ` [PATCH 06/19] ASoC: soc-card: move snd_soc_card_get_codec_dai() " Kuninori Morimoto
2020-05-26  1:17 ` [PATCH 07/19] ASoC: soc-card: move snd_soc_card_subclass " Kuninori Morimoto
2020-05-26  1:17 ` [PATCH 08/19] ASoC: soc-card: add snd_soc_card_suspend_pre() Kuninori Morimoto
2020-05-26  1:17 ` [PATCH 09/19] ASoC: soc-card: add snd_soc_card_suspend_post() Kuninori Morimoto
2020-05-26  1:17 ` [PATCH 10/19] ASoC: soc-card: add snd_soc_card_resume_pre() Kuninori Morimoto
2020-05-26  1:18 ` [PATCH 11/19] ASoC: soc-card: add snd_soc_card_resume_post() Kuninori Morimoto
2020-05-26  1:18 ` [PATCH 12/19] ASoC: soc-card: add probed bit field to snd_soc_card Kuninori Morimoto
2020-05-26 14:08   ` Pierre-Louis Bossart [this message]
2020-05-27 23:58     ` Kuninori Morimoto
2020-05-26  1:18 ` [PATCH 13/19] ASoC: soc-card: add snd_soc_card_probe() Kuninori Morimoto
2020-05-26  1:18 ` [PATCH 14/19] ASoC: soc-card: add snd_soc_card_late_probe() Kuninori Morimoto
2020-05-26  1:18 ` [PATCH 15/19] ASoC: soc-card: add snd_soc_card_remove() Kuninori Morimoto
2020-05-26  1:18 ` [PATCH 16/19] ASoC: soc-card: add snd_soc_card_set_bias_level() Kuninori Morimoto
2020-05-27  0:23   ` Ranjani Sridharan
2020-05-28  0:02     ` Kuninori Morimoto
2020-05-26  1:19 ` [PATCH 17/19] ASoC: soc-card: add snd_soc_card_set_bias_level_post() Kuninori Morimoto
2020-05-27  0:24   ` Ranjani Sridharan
2020-05-26  1:19 ` [PATCH 18/19] ASoC: soc-card: add snd_soc_card_add_dai_link() Kuninori Morimoto
2020-05-26  1:19 ` [PATCH 19/19] ASoC: soc-card: add snd_soc_card_remove_dai_link() 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=9d5d8e40-c39e-5533-5ccc-8d79fafc1168@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
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