ASoC: soc-dapm.c: cleanup snd_soc_dapm_new_dai()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Wed, 19 Oct 2022 00:37:00 +0000 (00:37 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 19 Oct 2022 12:05:31 +0000 (13:05 +0100)
commit5a7c2e962e42d19bf08ffe0ed56b40ba23717e2b
tree35e64993bf5dcd9880e4de4511f7e193f39fcb90
parent9941ba4baed0a4388028e2ce3ff769d50324068a
ASoC: soc-dapm.c: cleanup snd_soc_dapm_new_dai()

snd_soc_dapm_new_dai() setups local variable "template" at (X) and (Y),
which is used at (Z). But these are difficult to read.

static struct snd_soc_dapm_widget * snd_soc_dapm_new_dai()
{
...

 ^ template.reg = ...
 | template.id = ...
(X) template.name = ...
 | template.event = ...
 | template.event_flags = ...
 v template.kcontrol_news = ...

if (rtd->dai_link->num_params > 1) {
...
 ^ template.num_kcontrols = ...
(Y) template.kcontrol_news = ...
 v ...
}

...
(Z) w = snd_soc_dapm_new_control_unlocked(..., &template);

}

And this function has error message, but not for all cases.
This patch (1) setups "template" in one place, and indicate error message
for all cases. This patch cleanup the code, but nothing changed for
meaning.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Link: https://lore.kernel.org/r/871qr4tzro.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-dapm.c