mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-17 18:56:24 +00:00
ASoC: Refactor some conditions and loop in soc_bind_dai_link()
Transform some loops from: for_each(x) { if (f(x)) { work_on(x); } } to new structure: for_each(x) { if (!f(x)) continue; work_on(x); } This will allow future modification of f(x) with less impact to the code. Signed-off-by: Stephen Warren <swarren@nvidia.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
7b9b5e1170
commit
2610ab7767
@ -763,10 +763,11 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
|
|||||||
}
|
}
|
||||||
/* no, then find CPU DAI from registered DAIs*/
|
/* no, then find CPU DAI from registered DAIs*/
|
||||||
list_for_each_entry(cpu_dai, &dai_list, list) {
|
list_for_each_entry(cpu_dai, &dai_list, list) {
|
||||||
if (!strcmp(cpu_dai->name, dai_link->cpu_dai_name)) {
|
if (strcmp(cpu_dai->name, dai_link->cpu_dai_name))
|
||||||
rtd->cpu_dai = cpu_dai;
|
continue;
|
||||||
goto find_codec;
|
|
||||||
}
|
rtd->cpu_dai = cpu_dai;
|
||||||
|
goto find_codec;
|
||||||
}
|
}
|
||||||
dev_dbg(card->dev, "CPU DAI %s not registered\n",
|
dev_dbg(card->dev, "CPU DAI %s not registered\n",
|
||||||
dai_link->cpu_dai_name);
|
dai_link->cpu_dai_name);
|
||||||
@ -779,22 +780,28 @@ find_codec:
|
|||||||
|
|
||||||
/* no, then find CODEC from registered CODECs*/
|
/* no, then find CODEC from registered CODECs*/
|
||||||
list_for_each_entry(codec, &codec_list, list) {
|
list_for_each_entry(codec, &codec_list, list) {
|
||||||
if (!strcmp(codec->name, dai_link->codec_name)) {
|
if (strcmp(codec->name, dai_link->codec_name))
|
||||||
rtd->codec = codec;
|
continue;
|
||||||
|
|
||||||
/* CODEC found, so find CODEC DAI from registered DAIs from this CODEC*/
|
rtd->codec = codec;
|
||||||
list_for_each_entry(codec_dai, &dai_list, list) {
|
|
||||||
if (codec->dev == codec_dai->dev &&
|
/*
|
||||||
!strcmp(codec_dai->name, dai_link->codec_dai_name)) {
|
* CODEC found, so find CODEC DAI from registered DAIs from
|
||||||
rtd->codec_dai = codec_dai;
|
* this CODEC
|
||||||
goto find_platform;
|
*/
|
||||||
}
|
list_for_each_entry(codec_dai, &dai_list, list) {
|
||||||
|
if (codec->dev == codec_dai->dev &&
|
||||||
|
!strcmp(codec_dai->name,
|
||||||
|
dai_link->codec_dai_name)) {
|
||||||
|
|
||||||
|
rtd->codec_dai = codec_dai;
|
||||||
|
goto find_platform;
|
||||||
}
|
}
|
||||||
dev_dbg(card->dev, "CODEC DAI %s not registered\n",
|
|
||||||
dai_link->codec_dai_name);
|
|
||||||
|
|
||||||
goto find_platform;
|
|
||||||
}
|
}
|
||||||
|
dev_dbg(card->dev, "CODEC DAI %s not registered\n",
|
||||||
|
dai_link->codec_dai_name);
|
||||||
|
|
||||||
|
goto find_platform;
|
||||||
}
|
}
|
||||||
dev_dbg(card->dev, "CODEC %s not registered\n",
|
dev_dbg(card->dev, "CODEC %s not registered\n",
|
||||||
dai_link->codec_name);
|
dai_link->codec_name);
|
||||||
@ -811,10 +818,11 @@ find_platform:
|
|||||||
|
|
||||||
/* no, then find one from the set of registered platforms */
|
/* no, then find one from the set of registered platforms */
|
||||||
list_for_each_entry(platform, &platform_list, list) {
|
list_for_each_entry(platform, &platform_list, list) {
|
||||||
if (!strcmp(platform->name, platform_name)) {
|
if (strcmp(platform->name, platform_name))
|
||||||
rtd->platform = platform;
|
continue;
|
||||||
goto out;
|
|
||||||
}
|
rtd->platform = platform;
|
||||||
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
dev_dbg(card->dev, "platform %s not registered\n",
|
dev_dbg(card->dev, "platform %s not registered\n",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user