diff mbox series

[13/13] ASoC: soc-core: setup card->rtd_num at snd_soc_instantiate_card()

Message ID 87k1aglxb4.wl-kuninori.morimoto.gx@renesas.com (mailing list archive)
State New, archived
Headers show
Series ASoC: soc-core cleanup - step 3 | expand

Commit Message

Kuninori Morimoto Sept. 10, 2019, 2:06 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

card->rtd_num is used to count rtd. Initialize it at
snd_soc_instantiate_card() is very natural and less confusion.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/soc-core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Sridharan, Ranjani Sept. 10, 2019, 4:14 p.m. UTC | #1
On Mon, Sep 9, 2019 at 7:15 PM Kuninori Morimoto <
kuninori.morimoto.gx@renesas.com> wrote:

> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> card->rtd_num is used to count rtd. Initialize it at
> snd_soc_instantiate_card() is very natural and less confusion.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
Thanks for this clean-up, Morimoto-san. Just a couple of minor comments for
the series that I have replied on the relevant patches. But overall the
series looks good.

Thanks,
Ranjani

> ---
>  sound/soc/soc-core.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index bde885f..a5683da 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -451,8 +451,6 @@ static void soc_remove_pcm_runtimes(struct
> snd_soc_card *card)
>
>         for_each_card_rtds_safe(card, rtd, _rtd)
>                 soc_free_pcm_runtime(rtd);
> -
> -       card->num_rtd = 0;
>  }
>
>  struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card
> *card,
> @@ -1997,6 +1995,7 @@ static int snd_soc_instantiate_card(struct
> snd_soc_card *card)
>                 goto probe_end;
>
>         /* add predefined DAI links to the list */
> +       card->num_rtd = 0;
>         for_each_card_prelinks(card, i, dai_link) {
>                 ret = snd_soc_add_dai_link(card, dai_link);
>                 if (ret < 0)
> @@ -2407,7 +2406,6 @@ int snd_soc_register_card(struct snd_soc_card *card)
>         INIT_LIST_HEAD(&card->dapm_dirty);
>         INIT_LIST_HEAD(&card->dobj_list);
>
> -       card->num_rtd = 0;
>         card->instantiated = 0;
>         mutex_init(&card->mutex);
>         mutex_init(&card->dapm_mutex);
> --
> 2.7.4
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
Kuninori Morimoto Sept. 11, 2019, midnight UTC | #2
Hi Sridharan

Thank you for your review.

>     From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>    
>     card->rtd_num is used to count rtd. Initialize it at
>     snd_soc_instantiate_card() is very natural and less confusion.
>    
>     Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> Thanks for this clean-up, Morimoto-san. Just a couple of minor comments for
> the series that I have replied on the relevant
> patches. But overall the series looks good.

Thanks !
I will wait for other review, and fixup it in v2 and re-post these.

Thank you for your help !!
Best regards
---
Kuninori Morimoto
diff mbox series

Patch

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index bde885f..a5683da 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -451,8 +451,6 @@  static void soc_remove_pcm_runtimes(struct snd_soc_card *card)
 
 	for_each_card_rtds_safe(card, rtd, _rtd)
 		soc_free_pcm_runtime(rtd);
-
-	card->num_rtd = 0;
 }
 
 struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
@@ -1997,6 +1995,7 @@  static int snd_soc_instantiate_card(struct snd_soc_card *card)
 		goto probe_end;
 
 	/* add predefined DAI links to the list */
+	card->num_rtd = 0;
 	for_each_card_prelinks(card, i, dai_link) {
 		ret = snd_soc_add_dai_link(card, dai_link);
 		if (ret < 0)
@@ -2407,7 +2406,6 @@  int snd_soc_register_card(struct snd_soc_card *card)
 	INIT_LIST_HEAD(&card->dapm_dirty);
 	INIT_LIST_HEAD(&card->dobj_list);
 
-	card->num_rtd = 0;
 	card->instantiated = 0;
 	mutex_init(&card->mutex);
 	mutex_init(&card->dapm_mutex);