[Sound-open-firmware] [PATCH] [SQUASHME] ASoC: core: Make sure FE override adds sof- prefix once.

Liam Girdwood liam.r.girdwood at linux.intel.com
Thu Jun 14 16:05:34 CEST 2018


sof-prefix must only be added once.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 include/sound/soc.h  |  1 +
 sound/soc/soc-core.c | 18 +++++++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/include/sound/soc.h b/include/sound/soc.h
index 5684044b0f2a..e0a0a59b2852 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -1021,6 +1021,7 @@ struct snd_soc_card {
 	struct mutex dapm_mutex;
 
 	bool instantiated;
+	bool topology_shortname_created;
 
 	int (*probe)(struct snd_soc_card *card);
 	int (*late_probe)(struct snd_soc_card *card);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 0ee228933845..3fe1ed1f323e 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1873,6 +1873,7 @@ EXPORT_SYMBOL_GPL(snd_soc_set_dmi_name);
 static void soc_check_tplg_fes(struct snd_soc_card *card)
 {
 	struct snd_soc_component *component;
+	const struct snd_soc_component_driver *comp_drv;
 	struct snd_soc_dai_link *dai_link;
 	int i;
 
@@ -1922,12 +1923,19 @@ static void soc_check_tplg_fes(struct snd_soc_card *card)
 		}
 
 		/* Inform userspace we are using alternate topology */
-		if (component->driver->topology_name_prefix &&
-			card->name != card->topology_shortname) {
+		if (component->driver->topology_name_prefix) {
 
-			snprintf(card->topology_shortname, 32, "%s-%s",
-				 component->driver->topology_name_prefix,
-				 card->name);
+			/* topology shortname created ? */
+			if (!card->topology_shortname_created) {
+				comp_drv = component->driver;
+
+				snprintf(card->topology_shortname, 32, "%s-%s",
+					 comp_drv->topology_name_prefix,
+					 card->name);
+				card->topology_shortname_created = true;
+			}
+
+			/* use topology shortname */
 			card->name = card->topology_shortname;
 		}
 	}
-- 
2.17.1



More information about the Sound-open-firmware mailing list