summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorTzung-Bi Shih <tzungbi@google.com>2019-05-29 14:22:14 +0800
committerMark Brown <broonie@kernel.org>2019-05-29 16:37:46 +0100
commitb19671d6caf1ac393681864d5d85dda9fa99a448 (patch)
tree1a645486685d0d0fb1f2a157ef86b4049a31a550 /sound/soc/soc-core.c
parent7cda6223503d592f980a222811355ab07611b821 (diff)
downloadlinux-b19671d6caf1ac393681864d5d85dda9fa99a448.tar.bz2
ASoC: core: use component driver name as component name
fmt_single_name() uses device name to determine component name. If multiple components bind to the same device, the debugfs creation in soc_init_component_debugfs() would fail due to duplicated entity names. Name provided by component driver is unique enough to represent each component. Use component driver name as the component name to avoid name duplication. Signed-off-by: Tzung-Bi Shih <tzungbi@google.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index ce8c057bcd5b..5f83e2f19801 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3106,7 +3106,10 @@ static int snd_soc_component_initialize(struct snd_soc_component *component,
{
struct snd_soc_dapm_context *dapm;
- component->name = fmt_single_name(dev, &component->id);
+ if (driver->name)
+ component->name = kstrdup(driver->name, GFP_KERNEL);
+ else
+ component->name = fmt_single_name(dev, &component->id);
if (!component->name) {
dev_err(dev, "ASoC: Failed to allocate name\n");
return -ENOMEM;