ASoC: soc-core: merge snd_soc_add_dai_link() and soc_bind_dai_link()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 6 Nov 2019 01:07:31 +0000 (10:07 +0900)
committerMark Brown <broonie@kernel.org>
Tue, 12 Nov 2019 18:27:24 +0000 (18:27 +0000)
commit63dc47da1f396fecd2373e41928e275f9ca3d924
tree0987736f4eefbf68583d80e4523925277eedec29
parentffdbca0be6c78ea32b9243eea976270441210f2f
ASoC: soc-core: merge snd_soc_add_dai_link() and soc_bind_dai_link()

We don't need to separete snd_soc_add_dai_link() and
soc_bind_dai_link() anymore. Let's merge these.

One note is that before this patch, it adds list (A)
eventhough if it had dai_link->ignore (1), or already bounded dai_link (2).
But I guess it is wrong. This patch also solve this issue.

/* BEFORE */
int soc_bind_dai_link(...)
{
...
(1) if (dai_link->ignore)
return 0;

(2) if (soc_is_dai_link_bound(...))
return 0;
...
}

int snd_soc_add_dai_link(...)
{
...
=> ret = soc_bind_dai_link(...);
=> if (ret < 0)
=> return ret;

(A) list_add_tail(&dai_link->list, &card->dai_link_list);
...
}

/* AFTER */

int snd_soc_add_dai_link(...)
{
...
(1) if (dai_link->ignore)
return 0;

(2) if (soc_is_dai_link_bound(...))
return 0;
...
(A) list_add_tail(&dai_link->list, &card->dai_link_list);
return 0;
}

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87r22lhkx8.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-core.c