diff mbox series

[14/28] ASoC: soc-core: remove duplicated soc_is_dai_link_bound()

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

Commit Message

Kuninori Morimoto Aug. 6, 2019, 1:29 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

soc_is_dai_link_bound() check will be called both
*before* soc_bind_dai_link(), and
*under*  soc_bind_dai_link().
These are very verboqse.
Let's remove one of them.

*	static int soc_bind_dai_link(...)
	{
		...
=>		if (soc_is_dai_link_bound(...)) {
			...
			return 0;
		}
		...
	}

	static int snd_soc_instantiate_card(...)
	{
		...
		for_each_card_links(...) {
=>			if (soc_is_dai_link_bound(...))
=>				continue;
			...
*			ret = soc_bind_dai_link(...);
			if (ret)
				goto probe_end;
		}
		...
	}

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

Comments

Ranjani Sridharan Aug. 6, 2019, 4:49 a.m. UTC | #1
On Tue, 2019-08-06 at 10:29 +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> 
> soc_is_dai_link_bound() check will be called both
> *before* soc_bind_dai_link(), and
> *under*  soc_bind_dai_link().
> These are very verboqse.
> Let's remove one of them.
> 
> *	static int soc_bind_dai_link(...)
> 	{
> 		...
> =>		if (soc_is_dai_link_bound(...)) {
> 			...
> 			return 0;
> 		}
> 		...
> 	}
> 
> 	static int snd_soc_instantiate_card(...)
> 	{
> 		...
> 		for_each_card_links(...) {
> =>			if (soc_is_dai_link_bound(...))
> =>				continue;
> 			...
> *			ret = soc_bind_dai_link(...);
> 			if (ret)
> 				goto probe_end;
> 		}
> 		...
> 	}
Morimoto-san,

I think we should keep both the calls. The call to check if
(soc_is_dai_link_bound(...)) will prevent soc_init_dai_link() if the
dai link is already bound. 

Thanks,
Ranjani
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>  sound/soc/soc-core.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 838a843..e8ed57a 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -2016,9 +2016,6 @@ static int snd_soc_instantiate_card(struct
> snd_soc_card *card)
>  	 * Components with topology may bring new DAIs and DAI links.
>  	 */
>  	for_each_card_links(card, dai_link) {
> -		if (soc_is_dai_link_bound(card, dai_link))
> -			continue;
> -
>  		ret = soc_init_dai_link(card, dai_link);
>  		if (ret)
>  			goto probe_end;
diff mbox series

Patch

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 838a843..e8ed57a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2016,9 +2016,6 @@  static int snd_soc_instantiate_card(struct snd_soc_card *card)
 	 * Components with topology may bring new DAIs and DAI links.
 	 */
 	for_each_card_links(card, dai_link) {
-		if (soc_is_dai_link_bound(card, dai_link))
-			continue;
-
 		ret = soc_init_dai_link(card, dai_link);
 		if (ret)
 			goto probe_end;