Commit 71cb85f5 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-core: call snd_soc_register_dai() from snd_soc_register_dais()

ALSA SoC has 2 functions.
snd_soc_register_dai()  is used from topology
snd_soc_register_dais() is used from snd_soc_add_component()

In general, people think like _dai() is called from _dais()
with for loop. But in reality, these are very similar
but different implementation.
We shouldn't have duplicated and confusing implementation.

This patch calls snd_soc_register_dai() from snd_soc_register_dais()
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87r22m251l.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent e443c205
...@@ -2607,12 +2607,16 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, ...@@ -2607,12 +2607,16 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component,
struct snd_soc_dai_driver *dai_drv, struct snd_soc_dai_driver *dai_drv,
bool legacy_dai_naming) bool legacy_dai_naming)
{ {
if (dai_drv->dobj.type != SND_SOC_DOBJ_PCM) { struct device *dev = component->dev;
dev_err(component->dev, "Invalid dai type %d\n",
dai_drv->dobj.type); if (dai_drv->dobj.type &&
dai_drv->dobj.type != SND_SOC_DOBJ_PCM) {
dev_err(dev, "Invalid dai type %d\n", dai_drv->dobj.type);
return NULL; return NULL;
} }
dev_dbg(dev, "ASoC: dai register %s\n", dai_drv->name);
lockdep_assert_held(&client_mutex); lockdep_assert_held(&client_mutex);
return soc_add_dai(component, dai_drv, legacy_dai_naming); return soc_add_dai(component, dai_drv, legacy_dai_naming);
} }
...@@ -2642,16 +2646,12 @@ static int snd_soc_register_dais(struct snd_soc_component *component, ...@@ -2642,16 +2646,12 @@ static int snd_soc_register_dais(struct snd_soc_component *component,
struct snd_soc_dai_driver *dai_drv, struct snd_soc_dai_driver *dai_drv,
size_t count) size_t count)
{ {
struct device *dev = component->dev;
struct snd_soc_dai *dai; struct snd_soc_dai *dai;
unsigned int i; unsigned int i;
int ret; int ret;
dev_dbg(dev, "ASoC: dai register %s #%zu\n", dev_name(dev), count);
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
dai = snd_soc_register_dai(component, dai_drv + i, count == 1 &&
dai = soc_add_dai(component, dai_drv + i, count == 1 &&
!component->driver->non_legacy_dai_naming); !component->driver->non_legacy_dai_naming);
if (dai == NULL) { if (dai == NULL) {
ret = -ENOMEM; ret = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment