[alsa-devel] [PATCH 04/21] ASoC: soc-core: rename soc_init_dai_link() to soc_dai_link_sanity_check()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Fri Oct 11 03:19:35 CEST 2019


Hi Pierre-Louis

> > -	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?

soc_init_dai_link() is just sanity_check now.
In my understanding, it is needed before soc_bind_dai_link().

Current code is like below.
(1) and (2) are for care prelink:ed dai_link.
(A) and (B) are for topology added new dai_link.
and
(1) is for (2)
(A) is for (B)

	int snd_soc_instantiate_card()
	{
		for_each_card_prelinks(...) {
(1)			ret = soc_init_dai_link(...);
			...
		}
		...
		for_each_card_prelinks(...) {
(2)			ret = soc_bind_dai_link(...);
			...
		}
		...
		for_each_card_links(...) {
			...
(A)			ret = soc_init_dai_link(...);
			...
(B)			ret = soc_bind_dai_link(...);
		}
	}

It is very confusing/verbose code for me.
It can be more simple if we can call soc_init_dai_link()
from soc_bind_dai_link().


Thank you for your help !!
Best regards
---
Kuninori Morimoto


More information about the Alsa-devel mailing list