All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: core: use component driver name as component name
@ 2019-05-29  6:22 Tzung-Bi Shih
  2019-05-29 15:45 ` Applied "ASoC: core: use component driver name as component name" to the asoc tree Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Tzung-Bi Shih @ 2019-05-29  6:22 UTC (permalink / raw
  To: broonie; +Cc: tzungbi, alsa-devel, dgreid, cychiang

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>
---
Hi,

We got "Failed to create component debugfs directory" in our environment.
But the patch does not resolve the issue.
(https://mailman.alsa-project.org/pipermail/alsa-devel/2018-February/132391.html)

The entity name duplicated when creating the debugfs directory, because
there is a device registered 2 components in mt8183_afe_pcm_dev_probe()
in sound/soc/mediatek/mt8183/mt8183-afe-pcm.c.

 sound/soc/soc-core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 7abb017a83f3..2d3520fca613 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3113,7 +3113,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;
-- 
2.22.0.rc1.257.g3120a18244-goog

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Applied "ASoC: core: use component driver name as component name" to the asoc tree
  2019-05-29  6:22 [PATCH] ASoC: core: use component driver name as component name Tzung-Bi Shih
@ 2019-05-29 15:45 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2019-05-29 15:45 UTC (permalink / raw
  Cc: tzungbi, alsa-devel, Mark Brown, dgreid, cychiang

The patch

   ASoC: core: use component driver name as component name

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.3

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From b19671d6caf1ac393681864d5d85dda9fa99a448 Mon Sep 17 00:00:00 2001
From: Tzung-Bi Shih <tzungbi@google.com>
Date: Wed, 29 May 2019 14:22:14 +0800
Subject: [PATCH] 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>
---
 sound/soc/soc-core.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

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;
-- 
2.20.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-05-29 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-05-29  6:22 [PATCH] ASoC: core: use component driver name as component name Tzung-Bi Shih
2019-05-29 15:45 ` Applied "ASoC: core: use component driver name as component name" to the asoc tree Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.