mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-29 15:43:59 +08:00
ASoC: soc-core: tidyup soc_init_dai_link()
soc_init_dai_link() is needed to be called before soc_bind_dai_link(). 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(...); } ... (1) is for (2), and (A) is for (B) (1) and (2) are for card prelink dai_link. (A) and (B) are for topology added dai_link. soc_init_dai_link() is sanity check for dai_link, not initializing today. Therefore, it is confusable naming. We can rename it as sanity_check. And this check is for soc_bind_dai_link(). It can be more simple code if we can call it from soc_bind_dai_link(). This patch renames it to soc_dai_link_sanity_check(), and call it from soc_bind_dai_link(). Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/87d0e63joh.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
36794902de
commit
bfce78a559
@ -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,
|
||||
struct snd_soc_dai_link *link)
|
||||
{
|
||||
int i;
|
||||
struct snd_soc_dai_link_component *codec, *platform;
|
||||
@ -1043,7 +1043,7 @@ 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;
|
||||
@ -1056,6 +1056,10 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = soc_dai_link_sanity_check(card, dai_link);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
rtd = soc_new_pcm_runtime(card, dai_link);
|
||||
if (!rtd)
|
||||
return -ENOMEM;
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
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;
|
||||
ret = soc_bind_dai_link(card, dai_link);
|
||||
if (ret)
|
||||
goto probe_end;
|
||||
|
Loading…
Reference in New Issue
Block a user