On 10/8/19 11:30 PM, Kuninori Morimoto wrote:
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
soc_init_dai_link() is checking dai_link only, not initializing today. Therefore, we can rename it as sanity_check.
And this check is for soc_bind_dai_link(). Thus, we can check it under soc_bind_dai_link() to more clear code. This patch rename it, and call it from soc_bind_dai_link().
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
sound/soc/soc-core.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 335dc8f..f440022 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -941,8 +941,8 @@ static bool soc_is_dai_link_bound(struct snd_soc_card *card, return false; }
-static int soc_init_dai_link(struct snd_soc_card *card,
struct snd_soc_dai_link *link)
+static int soc_dai_link_sanity_check(struct snd_soc_card *card,
{ int i; struct snd_soc_dai_link_component *codec, *platform;struct snd_soc_dai_link *link)
@@ -1043,11 +1043,15 @@ static int soc_bind_dai_link(struct snd_soc_card *card, struct snd_soc_pcm_runtime *rtd; struct snd_soc_dai_link_component *codec, *platform; struct snd_soc_component *component;
- int i;
int i, ret;
if (dai_link->ignore) return 0;
ret = soc_dai_link_sanity_check(card, dai_link);
if (ret < 0)
return ret;
dev_dbg(card->dev, "ASoC: binding %s\n", dai_link->name);
if (soc_is_dai_link_bound(card, dai_link)) {
@@ -1985,15 +1989,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) int ret, i;
mutex_lock(&client_mutex);
- 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?
mutex_lock_nested(&card->mutex, SND_SOC_CARD_CLASS_INIT);
snd_soc_dapm_init(&card->dapm, card, NULL); @@ -2073,9 +2068,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) if (soc_is_dai_link_bound(card, dai_link)) continue;
ret = soc_init_dai_link(card, dai_link);
if (ret)
goto probe_end;
[2]
ret = soc_bind_dai_link(card, dai_link); if (ret) goto probe_end;