diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2016-07-11 19:59:16 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-07-16 08:03:04 -0400 |
commit | fc55c9b5a2ea794c4b6be937522bcfe98be4770a (patch) | |
tree | 6d1c00255504c1c256b9eaa3b876a0792dc5e713 | |
parent | 2e8d1c7d544089fe4894c504020d7ac7eb1de531 (diff) |
ASoC: simple-card-utils: add asoc_simple_card_parse_card_name()
simple-card needs to get its card name.
This patch makes this method simple style standard.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | include/sound/simple_card_utils.h | 2 | ||||
-rw-r--r-- | sound/soc/generic/simple-card-utils.c | 20 |
2 files changed, 22 insertions, 0 deletions
diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index b88a8dcfe4ba..86088aed9002 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h | |||
@@ -30,5 +30,7 @@ int asoc_simple_card_parse_daifmt(struct device *dev, | |||
30 | int asoc_simple_card_set_dailink_name(struct device *dev, | 30 | int asoc_simple_card_set_dailink_name(struct device *dev, |
31 | struct snd_soc_dai_link *dai_link, | 31 | struct snd_soc_dai_link *dai_link, |
32 | const char *fmt, ...); | 32 | const char *fmt, ...); |
33 | int asoc_simple_card_parse_card_name(struct snd_soc_card *card, | ||
34 | char *prefix); | ||
33 | 35 | ||
34 | #endif /* __SIMPLE_CARD_CORE_H */ | 36 | #endif /* __SIMPLE_CARD_CORE_H */ |
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 48c73660b66a..d89a9a1b2471 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c | |||
@@ -75,3 +75,23 @@ int asoc_simple_card_set_dailink_name(struct device *dev, | |||
75 | return ret; | 75 | return ret; |
76 | } | 76 | } |
77 | EXPORT_SYMBOL_GPL(asoc_simple_card_set_dailink_name); | 77 | EXPORT_SYMBOL_GPL(asoc_simple_card_set_dailink_name); |
78 | |||
79 | int asoc_simple_card_parse_card_name(struct snd_soc_card *card, | ||
80 | char *prefix) | ||
81 | { | ||
82 | char prop[128]; | ||
83 | int ret; | ||
84 | |||
85 | snprintf(prop, sizeof(prop), "%sname", prefix); | ||
86 | |||
87 | /* Parse the card name from DT */ | ||
88 | ret = snd_soc_of_parse_card_name(card, prop); | ||
89 | if (ret < 0) | ||
90 | return ret; | ||
91 | |||
92 | if (!card->name && card->dai_link) | ||
93 | card->name = card->dai_link->name; | ||
94 | |||
95 | return 0; | ||
96 | } | ||
97 | EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name); | ||