On 10/8/19 11:31 PM, Kuninori Morimoto wrote:
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
ALSA SoC has 2 similar but diffarent implementation. snd_soc_register_dai() is used from topology snd_soc_register_dais() is used from snd_soc_add_component()
Because of this kind of confusable naming, and duplicated implementation, code is very unreadale. We shouldn't have duplicated and confusable implementation. This patch calls snd_soc_register_dai() from snd_soc_register_dais()
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
sound/soc/soc-core.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index d4f80c8..bbcaac5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2610,14 +2610,17 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component, struct snd_soc_dai_driver *dai_drv, bool legacy_dai_naming) {
- struct device *dev = component->dev; struct snd_soc_dai *dai;
- if (dai_drv->dobj.type != SND_SOC_DOBJ_PCM) {
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) {
return NULL; }dev_err(dev, "Invalid dai type %d\n", dai_drv->dobj.type);
this block of code is removed in patch 20, so do we need the modification here?
- dev_dbg(dev, "ASoC: dai register %s\n", dai_drv->name);
- lockdep_assert_held(&client_mutex); dai = soc_add_dai(component, dai_drv, legacy_dai_naming); if (!dai)
@@ -2651,16 +2654,12 @@ static int snd_soc_register_dais(struct snd_soc_component *component, struct snd_soc_dai_driver *dai_drv, size_t count) {
struct device *dev = component->dev; struct snd_soc_dai *dai; unsigned int i; int ret;
dev_dbg(dev, "ASoC: dai register %s #%zu\n", dev_name(dev), count);
for (i = 0; i < count; i++) {
dai = soc_add_dai(component, dai_drv + i, count == 1 &&
if (dai == NULL) { ret = -ENOMEM;dai = snd_soc_register_dai(component, dai_drv + i, count == 1 && !component->driver->non_legacy_dai_naming);