[alsa-devel] [resend][PATCH v5 05/10] ASoC: simple-card-utils: enable "label" on asoc_simple_card_parse_card_name

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Mon Apr 17 02:22:40 CEST 2017


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

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

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

 - don't exchange simle-xxx-card side

 sound/soc/generic/simple-card-utils.c | 18 ++++++++++++++----
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index 4924575..4dfd9a2 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -82,14 +82,24 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
 				     char *prefix)
 {
 	char prop[128];
+	char *names[] = {
+		"label", "name"
+	};
+	int i;
 	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;
+	for (i = 0; i < ARRAY_SIZE(names); i++) {
+		snprintf(prop, sizeof(prop), "%s%s", prefix, names[i]);
+		ret = snd_soc_of_parse_card_name(card, prop);
+		if (ret < 0)
+			return ret;
+		if (card->name)
+			break;
+	}
 
 	if (!card->name && card->dai_link)
 		card->name = card->dai_link->name;
-- 
1.9.1



More information about the Alsa-devel mailing list