ASoC: samsung: arndale: Simplify DAI link initialization

There is only one DAI link so we can drop an unnecessary loop statement.
Use card->dai_link in place of direct static arndale_rt5631_dai[] array
dereference as a prerequisite for adding support for other CODECs.
Unnecessary assignment of dai_link->codecs->name to NULL is removed.

Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Link: https://lore.kernel.org/r/20191002105652.24821-1-s.nawrocki@samsung.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Sylwester Nawrocki 2019-10-02 12:56:50 +02:00 committed by Mark Brown
parent 25317997cb
commit aaa68472ed
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 16 additions and 22 deletions

View File

@ -88,36 +88,30 @@ static void arndale_put_of_nodes(struct snd_soc_card *card)
static int arndale_audio_probe(struct platform_device *pdev)
{
int n, ret;
struct device_node *np = pdev->dev.of_node;
struct snd_soc_card *card = &arndale_rt5631;
struct snd_soc_dai_link *dai_link;
int ret;
card->dev = &pdev->dev;
dai_link = card->dai_link;
for (n = 0; np && n < ARRAY_SIZE(arndale_rt5631_dai); n++) {
if (!arndale_rt5631_dai[n].cpus->dai_name) {
arndale_rt5631_dai[n].cpus->of_node = of_parse_phandle(np,
"samsung,audio-cpu", n);
dai_link->cpus->of_node = of_parse_phandle(np, "samsung,audio-cpu", 0);
if (!dai_link->cpus->of_node) {
dev_err(&pdev->dev,
"Property 'samsung,audio-cpu' missing or invalid\n");
return -EINVAL;
}
if (!arndale_rt5631_dai[n].cpus->of_node) {
dev_err(&pdev->dev,
"Property 'samsung,audio-cpu' missing or invalid\n");
return -EINVAL;
}
}
if (!arndale_rt5631_dai[n].platforms->name)
arndale_rt5631_dai[n].platforms->of_node =
arndale_rt5631_dai[n].cpus->of_node;
if (!dai_link->platforms->name)
dai_link->platforms->of_node = dai_link->cpus->of_node;
arndale_rt5631_dai[n].codecs->name = NULL;
arndale_rt5631_dai[n].codecs->of_node = of_parse_phandle(np,
"samsung,audio-codec", n);
if (!arndale_rt5631_dai[0].codecs->of_node) {
dev_err(&pdev->dev,
dai_link->codecs->of_node = of_parse_phandle(np, "samsung,audio-codec", 0);
if (!dai_link->codecs->of_node) {
dev_err(&pdev->dev,
"Property 'samsung,audio-codec' missing or invalid\n");
ret = -EINVAL;
goto err_put_of_nodes;
}
ret = -EINVAL;
goto err_put_of_nodes;
}
ret = devm_snd_soc_register_card(card->dev, card);