[alsa-devel] [PATCH v7 6/9] ASoC: simple-card-utils: enable "label" on asoc_simple_card_parse_card_name

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Thu Apr 20 03:34:49 CEST 2017


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

Current asoc_simple_card_parse_card_name() detects [prefix]name,
but in generally, we uses "label" for user visible names.
This patch enables it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
v6 -> v7

 - don't allow "[prefix]label"

 sound/soc/generic/simple-card-utils.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 343b291..c5ab8ad 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -81,15 +81,21 @@ int asoc_simple_card_set_dailink_name(struct device *dev,
 int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
 				     char *prefix)
 {
-	char prop[128];
 	int ret;
 
-	snprintf(prop, sizeof(prop), "%sname", prefix);
+	if (!prefix)
+		prefix = "";
 
 	/* Parse the card name from DT */
-	ret = snd_soc_of_parse_card_name(card, prop);
-	if (ret < 0)
-		return ret;
+	ret = snd_soc_of_parse_card_name(card, "label");
+	if (ret < 0) {
+		char prop[128];
+
+		snprintf(prop, sizeof(prop), "%sname", prefix);
+		ret = snd_soc_of_parse_card_name(card, prop);
+		if (ret < 0)
+			return ret;
+	}
 
 	if (!card->name && card->dai_link)
 		card->name = card->dai_link->name;
-- 
1.9.1



More information about the Alsa-devel mailing list