* [alsa-devel] [PATCH RFC] ASoC: core: ensure component names are unique @ 2020-02-14 13:47 Jerome Brunet 2020-02-14 20:56 ` [alsa-devel] Applied "ASoC: core: ensure component names are unique" to the asoc tree Mark Brown 0 siblings, 1 reply; 12+ messages in thread From: Jerome Brunet @ 2020-02-14 13:47 UTC (permalink / raw) To: Mark Brown, Liam Girdwood; +Cc: alsa-devel, linux-kernel, Jerome Brunet Make sure each ASoC component is registered with a unique name. The component is derived from the device name. If a device registers more than one component, the component names will be the same. This usually brings up a warning about the debugfs directory creation of the component since directory already exists. In such case, start numbering the component of the device so the names don't collide anymore. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> --- * Here is an example of /sys/kernel/debug/asoc/components before the change: hdmi-audio-codec.3.auto c1105400.audio-controller c1105400.audio-controller c1105400.audio-controller c8832000.audio-controller analog-amplifier snd-soc-dummy snd-soc-dummy * and after: hdmi-audio-codec.3.auto c1105400.audio-controller-2 c1105400.audio-controller-1 c1105400.audio-controller c8832000.audio-controller analog-amplifier snd-soc-dummy-1 snd-soc-dummy I wanted to keep the name as they were for the devices registering only one component but we could also start the numbering from the first component instead of the second. sound/soc/soc-core.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 03b87427faa7..6a58a8f6e3c4 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2446,6 +2446,33 @@ static int snd_soc_register_dais(struct snd_soc_component *component, return ret; } +static char *snd_soc_component_unique_name(struct device *dev, + struct snd_soc_component *component) +{ + struct snd_soc_component *pos; + int count = 0; + char *name, *unique; + + name = fmt_single_name(dev, &component->id); + if (!name) + return name; + + /* Count the number of components registred by the device */ + for_each_component(pos) { + if (dev == pos->dev) + count++; + } + + /* Keep naming as it is for the 1st component */ + if (!count) + return name; + + unique = devm_kasprintf(dev, GFP_KERNEL, "%s-%d", name, count); + devm_kfree(dev, name); + + return unique; +} + static int snd_soc_component_initialize(struct snd_soc_component *component, const struct snd_soc_component_driver *driver, struct device *dev) { @@ -2454,7 +2481,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component, INIT_LIST_HEAD(&component->card_list); mutex_init(&component->io_mutex); - component->name = fmt_single_name(dev, &component->id); + component->name = snd_soc_component_unique_name(dev, component); if (!component->name) { dev_err(dev, "ASoC: Failed to allocate name\n"); return -ENOMEM; -- 2.24.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [alsa-devel] Applied "ASoC: core: ensure component names are unique" to the asoc tree 2020-02-14 13:47 [alsa-devel] [PATCH RFC] ASoC: core: ensure component names are unique Jerome Brunet @ 2020-02-14 20:56 ` Mark Brown [not found] ` <CGME20200217121336eucas1p2deb35417f5c4646a89762fd6146c3cf9@eucas1p2.samsung.com> 2020-02-18 18:55 ` Jerome Brunet 0 siblings, 2 replies; 12+ messages in thread From: Mark Brown @ 2020-02-14 20:56 UTC (permalink / raw) To: Jerome Brunet; +Cc: alsa-devel, Mark Brown, Liam Girdwood, linux-kernel The patch ASoC: core: ensure component names are unique has been applied to the asoc tree at https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git 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 b2354e4009a773c00054b964d937e1b81cb92078 Mon Sep 17 00:00:00 2001 From: Jerome Brunet <jbrunet@baylibre.com> Date: Fri, 14 Feb 2020 14:47:04 +0100 Subject: [PATCH] ASoC: core: ensure component names are unique Make sure each ASoC component is registered with a unique name. The component is derived from the device name. If a device registers more than one component, the component names will be the same. This usually brings up a warning about the debugfs directory creation of the component since directory already exists. In such case, start numbering the component of the device so the names don't collide anymore. Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Link: https://lore.kernel.org/r/20200214134704.342501-1-jbrunet@baylibre.com Signed-off-by: Mark Brown <broonie@kernel.org> --- sound/soc/soc-core.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 03b87427faa7..6a58a8f6e3c4 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2446,6 +2446,33 @@ static int snd_soc_register_dais(struct snd_soc_component *component, return ret; } +static char *snd_soc_component_unique_name(struct device *dev, + struct snd_soc_component *component) +{ + struct snd_soc_component *pos; + int count = 0; + char *name, *unique; + + name = fmt_single_name(dev, &component->id); + if (!name) + return name; + + /* Count the number of components registred by the device */ + for_each_component(pos) { + if (dev == pos->dev) + count++; + } + + /* Keep naming as it is for the 1st component */ + if (!count) + return name; + + unique = devm_kasprintf(dev, GFP_KERNEL, "%s-%d", name, count); + devm_kfree(dev, name); + + return unique; +} + static int snd_soc_component_initialize(struct snd_soc_component *component, const struct snd_soc_component_driver *driver, struct device *dev) { @@ -2454,7 +2481,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component, INIT_LIST_HEAD(&component->card_list); mutex_init(&component->io_mutex); - component->name = fmt_single_name(dev, &component->id); + component->name = snd_soc_component_unique_name(dev, component); if (!component->name) { dev_err(dev, "ASoC: Failed to allocate name\n"); return -ENOMEM; -- 2.20.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply related [flat|nested] 12+ messages in thread
[parent not found: <CGME20200217121336eucas1p2deb35417f5c4646a89762fd6146c3cf9@eucas1p2.samsung.com>]
* Re: [alsa-devel] Applied "ASoC: core: ensure component names are unique" to the asoc tree [not found] ` <CGME20200217121336eucas1p2deb35417f5c4646a89762fd6146c3cf9@eucas1p2.samsung.com> @ 2020-02-17 12:13 ` Marek Szyprowski 2020-02-17 13:18 ` Jerome Brunet 2020-02-17 13:22 ` [alsa-devel] Applied "ASoC: core: ensure component names are unique" to the asoc tree Peter Ujfalusi 0 siblings, 2 replies; 12+ messages in thread From: Marek Szyprowski @ 2020-02-17 12:13 UTC (permalink / raw) To: Mark Brown, Jerome Brunet Cc: alsa-devel, Liam Girdwood, linux-rpi-kernel, linux-kernel Dear All, On 14.02.2020 21:56, Mark Brown wrote: > The patch > > ASoC: core: ensure component names are unique > > has been applied to the asoc tree at > > https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git > > 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 b2354e4009a773c00054b964d937e1b81cb92078 Mon Sep 17 00:00:00 2001 > From: Jerome Brunet <jbrunet@baylibre.com> > Date: Fri, 14 Feb 2020 14:47:04 +0100 > Subject: [PATCH] ASoC: core: ensure component names are unique > > Make sure each ASoC component is registered with a unique name. > The component is derived from the device name. If a device registers more > than one component, the component names will be the same. > > This usually brings up a warning about the debugfs directory creation of > the component since directory already exists. > > In such case, start numbering the component of the device so the names > don't collide anymore. > > Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> > Link: https://lore.kernel.org/r/20200214134704.342501-1-jbrunet@baylibre.com > Signed-off-by: Mark Brown <broonie@kernel.org> This patch landed in today's linux-next and I've noticed that it breaks registration of VC4 DRM driver on Raspberry Pi3 boards (I've compiled kernel from bcm2835_defconfig): sysfs: cannot create duplicate filename '/devices/platform/soc/3f902000.hdmi/dma:audio-rx' CPU: 0 PID: 67 Comm: kworker/0:2 Tainted: G W 5.6.0-rc2-next-20200217 #314 Hardware name: BCM2835 Workqueue: events deferred_probe_work_func Backtrace: [<c010c424>] (dump_backtrace) from [<c010c8a8>] (show_stack+0x20/0x24) r7:eb73d5c0 r6:eb53a8f0 r5:eb73d5c0 r4:eb4d3000 [<c010c888>] (show_stack) from [<c080ad40>] (dump_stack+0x20/0x28) [<c080ad20>] (dump_stack) from [<c02be6e0>] (sysfs_warn_dup+0x60/0x74) [<c02be680>] (sysfs_warn_dup) from [<c02bea00>] (sysfs_do_create_link_sd+0xa4/0xc0) r7:eb73d5c0 r6:eb53a8f0 r5:eb6becb8 r4:ffffffef [<c02be95c>] (sysfs_do_create_link_sd) from [<c02beb68>] (sysfs_create_link+0x34/0x44) r9:eb698c40 r8:c093e47c r7:00000000 r6:eb537e10 r5:eb6f9900 r4:eb537e10 [<c02beb34>] (sysfs_create_link) from [<c0415afc>] (dma_request_chan+0x1b8/0x208) [<c0415944>] (dma_request_chan) from [<c05f25a0>] (snd_dmaengine_pcm_register+0xf4/0x1bc) r10:c0963460 r9:eb537e10 r8:c093e47c r7:00000000 r6:eb537e10 r5:eb6f9900 r4:c093e468 [<c05f24ac>] (snd_dmaengine_pcm_register) from [<c05f0ebc>] (devm_snd_dmaengine_pcm_register+0x4c/0x84) r10:eb715c4c r9:c093e3d4 r8:eb537e00 r7:00000000 r6:eb537e10 r5:eb7ca240 r4:c093e468 [<c05f0e70>] (devm_snd_dmaengine_pcm_register) from [<c0492dc0>] (vc4_hdmi_bind+0x3a8/0x590) r7:eb537e10 r6:eb537e10 r5:eb715440 r4:eb715c40 [<c0492a18>] (vc4_hdmi_bind) from [<c049b6e0>] (component_bind_all+0x128/0x238) r10:eb7267c0 r9:00000008 r8:eb73f800 r7:00000018 r6:00000000 r5:eb7016c0 r4:eb6c9240 [<c049b5b8>] (component_bind_all) from [<c048c150>] (vc4_drm_bind+0xe4/0x17c) r9:00000008 r8:eb6c88c0 r7:eb6a2840 r6:eb53b210 r5:00000000 r4:eb73f800 [<c048c06c>] (vc4_drm_bind) from [<c049adc8>] (try_to_bring_up_master+0x190/0x264) r7:eb6a2840 r6:000000a8 r5:eb7267c0 r4:eb6c9240 [<c049ac38>] (try_to_bring_up_master) from [<c049b13c>] (__component_add+0x80/0x114) r10:c0d57488 r9:00000012 r8:00000000 r7:eb6c9240 r6:c093e924 r5:c0d572f8 r4:eb7267c0 [<c049b0bc>] (__component_add) from [<c049b1ec>] (component_add+0x1c/0x20) r7:c0d56f7c r6:c0d56f7c r5:eb534a10 r4:00000000 [<c049b1d0>] (component_add) from [<c0493864>] (vc4_vec_dev_probe+0x20/0x28) [<c0493844>] (vc4_vec_dev_probe) from [<c04a43a4>] (platform_drv_probe+0x58/0xa8) [<c04a434c>] (platform_drv_probe) from [<c04a2298>] (really_probe+0x1a8/0x428) r7:c0d56f7c r6:00000000 r5:c0e579b8 r4:eb534a10 [<c04a20f0>] (really_probe) from [<c04a2840>] (driver_probe_device+0x158/0x1ac) r9:00000000 r8:00000001 r7:eb70fe9c r6:c0d56f7c r5:c0d56f7c r4:eb534a10 [<c04a26e8>] (driver_probe_device) from [<c04a2a40>] (__device_attach_driver+0xb0/0xf8) r9:00000000 r8:00000001 r7:eb70fe9c r6:c0d56f7c r5:eb534a10 r4:00000001 [<c04a2990>] (__device_attach_driver) from [<c04a0408>] (bus_for_each_drv+0xa0/0xc8) r7:c04a2990 r6:eb70fe9c r5:c0d04248 r4:00000000 [<c04a0368>] (bus_for_each_drv) from [<c04a25bc>] (__device_attach+0xa4/0x158) r7:eb534a54 r6:c0d04248 r5:c0d576a8 r4:eb534a10 [<c04a2518>] (__device_attach) from [<c04a2aa4>] (device_initial_probe+0x1c/0x20) r8:eb9c7300 r7:00000000 r6:eb534a10 r5:c0d576a8 r4:eb534a10 [<c04a2a88>] (device_initial_probe) from [<c04a12d4>] (bus_probe_device+0x38/0x90) [<c04a129c>] (bus_probe_device) from [<c04a1848>] (deferred_probe_work_func+0x70/0xb0) r7:00000000 r6:c0d57478 r5:c0d5746c r4:eb534a10 [<c04a17d8>] (deferred_probe_work_func) from [<c0135a50>] (process_one_work+0x1a8/0x2ac) r7:00000000 r6:c0d0c8a4 r5:c0d57484 r4:eb6ed880 [<c01358a8>] (process_one_work) from [<c0136ddc>] (worker_thread+0x1f0/0x2e8) r10:00000000 r9:c0d156e0 r8:c0d0c8b8 r7:c0d156e0 r6:c0d0c8a4 r5:eb6ed894 r4:eb6ed880 [<c0136bec>] (worker_thread) from [<c013b5a0>] (kthread+0x120/0x130) r10:00000000 r9:eb6f5018 r8:eb4e9e98 r7:c0136bec r6:eb6ed880 r5:eb6e6b40 r4:eb6f5000 r3:00000000 [<c013b480>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c) Exception stack(0xeb70ffb0 to 0xeb70fff8) ffa0: 00000000 00000000 00000000 00000000 ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c013b480 r4:eb6e6b40 vc4_hdmi 3f902000.hdmi: Cannot create DMA dma:audio-rx symlink vc4_hdmi 3f902000.hdmi: ASoC: CODEC DAI vc4-hdmi-hifi not registered vc4_hdmi 3f902000.hdmi: Could not register sound card: -517 vc4-drm soc:gpu: failed to bind 3f902000.hdmi (ops vc4_hdmi_ops): -517 vc4-drm soc:gpu: master bind failed: -517 Reverting this patch fixes vc4-drm driver registration and initialization. If I find some spare time I will debug this issue further, but it looks that it is somehow related to deferred probe. > --- > sound/soc/soc-core.c | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c > index 03b87427faa7..6a58a8f6e3c4 100644 > --- a/sound/soc/soc-core.c > +++ b/sound/soc/soc-core.c > @@ -2446,6 +2446,33 @@ static int snd_soc_register_dais(struct snd_soc_component *component, > return ret; > } > > +static char *snd_soc_component_unique_name(struct device *dev, > + struct snd_soc_component *component) > +{ > + struct snd_soc_component *pos; > + int count = 0; > + char *name, *unique; > + > + name = fmt_single_name(dev, &component->id); > + if (!name) > + return name; > + > + /* Count the number of components registred by the device */ > + for_each_component(pos) { > + if (dev == pos->dev) > + count++; > + } > + > + /* Keep naming as it is for the 1st component */ > + if (!count) > + return name; > + > + unique = devm_kasprintf(dev, GFP_KERNEL, "%s-%d", name, count); > + devm_kfree(dev, name); > + > + return unique; > +} > + > static int snd_soc_component_initialize(struct snd_soc_component *component, > const struct snd_soc_component_driver *driver, struct device *dev) > { > @@ -2454,7 +2481,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component, > INIT_LIST_HEAD(&component->card_list); > mutex_init(&component->io_mutex); > > - component->name = fmt_single_name(dev, &component->id); > + component->name = snd_soc_component_unique_name(dev, component); > if (!component->name) { > dev_err(dev, "ASoC: Failed to allocate name\n"); > return -ENOMEM; Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [alsa-devel] Applied "ASoC: core: ensure component names are unique" to the asoc tree 2020-02-17 12:13 ` Marek Szyprowski @ 2020-02-17 13:18 ` Jerome Brunet 2020-02-17 14:36 ` Marek Szyprowski 2020-02-17 13:22 ` [alsa-devel] Applied "ASoC: core: ensure component names are unique" to the asoc tree Peter Ujfalusi 1 sibling, 1 reply; 12+ messages in thread From: Jerome Brunet @ 2020-02-17 13:18 UTC (permalink / raw) To: Marek Szyprowski, Mark Brown Cc: alsa-devel, Liam Girdwood, linux-rpi-kernel, linux-kernel On Mon 17 Feb 2020 at 13:13, Marek Szyprowski <m.szyprowski@samsung.com> wrote: > Dear All, > > On 14.02.2020 21:56, Mark Brown wrote: >> The patch >> >> ASoC: core: ensure component names are unique >> >> has been applied to the asoc tree at >> >> https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git >> >> 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 b2354e4009a773c00054b964d937e1b81cb92078 Mon Sep 17 00:00:00 2001 >> From: Jerome Brunet <jbrunet@baylibre.com> >> Date: Fri, 14 Feb 2020 14:47:04 +0100 >> Subject: [PATCH] ASoC: core: ensure component names are unique >> >> Make sure each ASoC component is registered with a unique name. >> The component is derived from the device name. If a device registers more >> than one component, the component names will be the same. >> >> This usually brings up a warning about the debugfs directory creation of >> the component since directory already exists. >> >> In such case, start numbering the component of the device so the names >> don't collide anymore. >> >> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> >> Link: https://lore.kernel.org/r/20200214134704.342501-1-jbrunet@baylibre.com >> Signed-off-by: Mark Brown <broonie@kernel.org> > > This patch landed in today's linux-next and I've noticed that it breaks > registration of VC4 DRM driver on Raspberry Pi3 boards (I've compiled > kernel from bcm2835_defconfig): I think I have an idea about what is going on. (good catch in the defer BTW) 1) Funny to see that the vc4-hdmi already registers several (3) ASoC components. It must have had warning about the debugfs entry before this patch. 2) Let say that vc4 hdmi driver defers after the registration of the 2nd component (/drivers/gpu/drm/vc4/vc4-hdmi.c:1082). The devm callback of the 2nd component will run first and call snd_soc_unregister_component(). The catch is that this function unregisters all the components registered by the linux device so far. 3) Then the devm callback of the dma_engine will run snd_dmaengine_pcm_unregister() (sound/soc/soc-generic-dmaengine-pcm.c:466) and the lookup will not find the component dmaengine component since it is already unregistered. The function bails out and dmaengine_pcm_release_chan() is not run. 4) Next time the hdmi driver tries to probe, the it will fail to allocate the DMA channel because the sysfs entry already exists. I would suspect that any driver doing: 1) devm_snd_dmaengine_pcm_register() 2) devm_snd_soc_register_component() could be exposed to this issue, even before this patch. I don't really get is triggering the issue in this change. Maybe it would be better if the devm callback of devm_snd_soc_register_component() unregistered only the related component. > > sysfs: cannot create duplicate filename > '/devices/platform/soc/3f902000.hdmi/dma:audio-rx' > CPU: 0 PID: 67 Comm: kworker/0:2 Tainted: G W > 5.6.0-rc2-next-20200217 #314 > Hardware name: BCM2835 > Workqueue: events deferred_probe_work_func > Backtrace: > [<c010c424>] (dump_backtrace) from [<c010c8a8>] (show_stack+0x20/0x24) > r7:eb73d5c0 r6:eb53a8f0 r5:eb73d5c0 r4:eb4d3000 > [<c010c888>] (show_stack) from [<c080ad40>] (dump_stack+0x20/0x28) > [<c080ad20>] (dump_stack) from [<c02be6e0>] (sysfs_warn_dup+0x60/0x74) > [<c02be680>] (sysfs_warn_dup) from [<c02bea00>] > (sysfs_do_create_link_sd+0xa4/0xc0) > r7:eb73d5c0 r6:eb53a8f0 r5:eb6becb8 r4:ffffffef > [<c02be95c>] (sysfs_do_create_link_sd) from [<c02beb68>] > (sysfs_create_link+0x34/0x44) > r9:eb698c40 r8:c093e47c r7:00000000 r6:eb537e10 r5:eb6f9900 r4:eb537e10 > [<c02beb34>] (sysfs_create_link) from [<c0415afc>] > (dma_request_chan+0x1b8/0x208) > [<c0415944>] (dma_request_chan) from [<c05f25a0>] > (snd_dmaengine_pcm_register+0xf4/0x1bc) > r10:c0963460 r9:eb537e10 r8:c093e47c r7:00000000 r6:eb537e10 r5:eb6f9900 > r4:c093e468 > [<c05f24ac>] (snd_dmaengine_pcm_register) from [<c05f0ebc>] > (devm_snd_dmaengine_pcm_register+0x4c/0x84) > r10:eb715c4c r9:c093e3d4 r8:eb537e00 r7:00000000 r6:eb537e10 r5:eb7ca240 > r4:c093e468 > [<c05f0e70>] (devm_snd_dmaengine_pcm_register) from [<c0492dc0>] > (vc4_hdmi_bind+0x3a8/0x590) > r7:eb537e10 r6:eb537e10 r5:eb715440 r4:eb715c40 > [<c0492a18>] (vc4_hdmi_bind) from [<c049b6e0>] > (component_bind_all+0x128/0x238) > r10:eb7267c0 r9:00000008 r8:eb73f800 r7:00000018 r6:00000000 r5:eb7016c0 > r4:eb6c9240 > [<c049b5b8>] (component_bind_all) from [<c048c150>] > (vc4_drm_bind+0xe4/0x17c) > r9:00000008 r8:eb6c88c0 r7:eb6a2840 r6:eb53b210 r5:00000000 r4:eb73f800 > [<c048c06c>] (vc4_drm_bind) from [<c049adc8>] > (try_to_bring_up_master+0x190/0x264) > r7:eb6a2840 r6:000000a8 r5:eb7267c0 r4:eb6c9240 > [<c049ac38>] (try_to_bring_up_master) from [<c049b13c>] > (__component_add+0x80/0x114) > r10:c0d57488 r9:00000012 r8:00000000 r7:eb6c9240 r6:c093e924 r5:c0d572f8 > r4:eb7267c0 > [<c049b0bc>] (__component_add) from [<c049b1ec>] (component_add+0x1c/0x20) > r7:c0d56f7c r6:c0d56f7c r5:eb534a10 r4:00000000 > [<c049b1d0>] (component_add) from [<c0493864>] (vc4_vec_dev_probe+0x20/0x28) > [<c0493844>] (vc4_vec_dev_probe) from [<c04a43a4>] > (platform_drv_probe+0x58/0xa8) > [<c04a434c>] (platform_drv_probe) from [<c04a2298>] > (really_probe+0x1a8/0x428) > r7:c0d56f7c r6:00000000 r5:c0e579b8 r4:eb534a10 > [<c04a20f0>] (really_probe) from [<c04a2840>] > (driver_probe_device+0x158/0x1ac) > r9:00000000 r8:00000001 r7:eb70fe9c r6:c0d56f7c r5:c0d56f7c r4:eb534a10 > [<c04a26e8>] (driver_probe_device) from [<c04a2a40>] > (__device_attach_driver+0xb0/0xf8) > r9:00000000 r8:00000001 r7:eb70fe9c r6:c0d56f7c r5:eb534a10 r4:00000001 > [<c04a2990>] (__device_attach_driver) from [<c04a0408>] > (bus_for_each_drv+0xa0/0xc8) > r7:c04a2990 r6:eb70fe9c r5:c0d04248 r4:00000000 > [<c04a0368>] (bus_for_each_drv) from [<c04a25bc>] > (__device_attach+0xa4/0x158) > r7:eb534a54 r6:c0d04248 r5:c0d576a8 r4:eb534a10 > [<c04a2518>] (__device_attach) from [<c04a2aa4>] > (device_initial_probe+0x1c/0x20) > r8:eb9c7300 r7:00000000 r6:eb534a10 r5:c0d576a8 r4:eb534a10 > [<c04a2a88>] (device_initial_probe) from [<c04a12d4>] > (bus_probe_device+0x38/0x90) > [<c04a129c>] (bus_probe_device) from [<c04a1848>] > (deferred_probe_work_func+0x70/0xb0) > r7:00000000 r6:c0d57478 r5:c0d5746c r4:eb534a10 > [<c04a17d8>] (deferred_probe_work_func) from [<c0135a50>] > (process_one_work+0x1a8/0x2ac) > r7:00000000 r6:c0d0c8a4 r5:c0d57484 r4:eb6ed880 > [<c01358a8>] (process_one_work) from [<c0136ddc>] > (worker_thread+0x1f0/0x2e8) > r10:00000000 r9:c0d156e0 r8:c0d0c8b8 r7:c0d156e0 r6:c0d0c8a4 r5:eb6ed894 > r4:eb6ed880 > [<c0136bec>] (worker_thread) from [<c013b5a0>] (kthread+0x120/0x130) > r10:00000000 r9:eb6f5018 r8:eb4e9e98 r7:c0136bec r6:eb6ed880 r5:eb6e6b40 > r4:eb6f5000 r3:00000000 > [<c013b480>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c) > Exception stack(0xeb70ffb0 to 0xeb70fff8) > ffa0: 00000000 00000000 00000000 > 00000000 > ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 > ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 > r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c013b480 r4:eb6e6b40 > vc4_hdmi 3f902000.hdmi: Cannot create DMA dma:audio-rx symlink > vc4_hdmi 3f902000.hdmi: ASoC: CODEC DAI vc4-hdmi-hifi not registered > vc4_hdmi 3f902000.hdmi: Could not register sound card: -517 > vc4-drm soc:gpu: failed to bind 3f902000.hdmi (ops vc4_hdmi_ops): -517 > vc4-drm soc:gpu: master bind failed: -517 > > Reverting this patch fixes vc4-drm driver registration and > initialization. If I find some spare time I will debug this issue > further, but it looks that it is somehow related to deferred probe. > > >> --- >> sound/soc/soc-core.c | 29 ++++++++++++++++++++++++++++- >> 1 file changed, 28 insertions(+), 1 deletion(-) >> >> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c >> index 03b87427faa7..6a58a8f6e3c4 100644 >> --- a/sound/soc/soc-core.c >> +++ b/sound/soc/soc-core.c >> @@ -2446,6 +2446,33 @@ static int snd_soc_register_dais(struct snd_soc_component *component, >> return ret; >> } >> >> +static char *snd_soc_component_unique_name(struct device *dev, >> + struct snd_soc_component *component) >> +{ >> + struct snd_soc_component *pos; >> + int count = 0; >> + char *name, *unique; >> + >> + name = fmt_single_name(dev, &component->id); >> + if (!name) >> + return name; >> + >> + /* Count the number of components registred by the device */ >> + for_each_component(pos) { >> + if (dev == pos->dev) >> + count++; >> + } >> + >> + /* Keep naming as it is for the 1st component */ >> + if (!count) >> + return name; >> + >> + unique = devm_kasprintf(dev, GFP_KERNEL, "%s-%d", name, count); >> + devm_kfree(dev, name); >> + >> + return unique; >> +} >> + >> static int snd_soc_component_initialize(struct snd_soc_component *component, >> const struct snd_soc_component_driver *driver, struct device *dev) >> { >> @@ -2454,7 +2481,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component, >> INIT_LIST_HEAD(&component->card_list); >> mutex_init(&component->io_mutex); >> >> - component->name = fmt_single_name(dev, &component->id); >> + component->name = snd_soc_component_unique_name(dev, component); >> if (!component->name) { >> dev_err(dev, "ASoC: Failed to allocate name\n"); >> return -ENOMEM; > > Best regards _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [alsa-devel] Applied "ASoC: core: ensure component names are unique" to the asoc tree 2020-02-17 13:18 ` Jerome Brunet @ 2020-02-17 14:36 ` Marek Szyprowski 2020-02-17 17:23 ` Stefan Wahren 2020-02-17 18:06 ` [RFT/DONTMERGE] ASoC: devm_snd_soc_register_component fixup Jerome Brunet 0 siblings, 2 replies; 12+ messages in thread From: Marek Szyprowski @ 2020-02-17 14:36 UTC (permalink / raw) To: Jerome Brunet, Mark Brown Cc: alsa-devel, Liam Girdwood, linux-rpi-kernel, linux-kernel Hi Jerome, On 17.02.2020 14:18, Jerome Brunet wrote: > On Mon 17 Feb 2020 at 13:13, Marek Szyprowski <m.szyprowski@samsung.com> wrote: >> On 14.02.2020 21:56, Mark Brown wrote: >>> The patch >>> >>> ASoC: core: ensure component names are unique >>> >>> has been applied to the asoc tree at >>> >>> https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git >>> >>> 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 b2354e4009a773c00054b964d937e1b81cb92078 Mon Sep 17 00:00:00 2001 >>> From: Jerome Brunet <jbrunet@baylibre.com> >>> Date: Fri, 14 Feb 2020 14:47:04 +0100 >>> Subject: [PATCH] ASoC: core: ensure component names are unique >>> >>> Make sure each ASoC component is registered with a unique name. >>> The component is derived from the device name. If a device registers more >>> than one component, the component names will be the same. >>> >>> This usually brings up a warning about the debugfs directory creation of >>> the component since directory already exists. >>> >>> In such case, start numbering the component of the device so the names >>> don't collide anymore. >>> >>> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> >>> Link: https://lore.kernel.org/r/20200214134704.342501-1-jbrunet@baylibre.com >>> Signed-off-by: Mark Brown <broonie@kernel.org> >> This patch landed in today's linux-next and I've noticed that it breaks >> registration of VC4 DRM driver on Raspberry Pi3 boards (I've compiled >> kernel from bcm2835_defconfig): > I think I have an idea about what is going on. (good catch in the defer BTW) > > 1) Funny to see that the vc4-hdmi already registers several (3) ASoC > components. It must have had warning about the debugfs entry before this patch. Okay, right, before this patch there is a warning from debugfs I've missed (debugfs was not enabled in bcm2835_defconfig): raspberrypi-firmware soc:firmware: Attached to firmware from 2019-07-09 14:40 raspberrypi-clk raspberrypi-clk: CPU frequency range: min 600000000, max 1200000000 debugfs: Directory '3f902000.hdmi' with parent 'vc4-hdmi' already present! vc4_hdmi 3f902000.hdmi: vc4-hdmi-hifi <-> 3f902000.hdmi mapping ok vc4-drm soc:gpu: bound 3f902000.hdmi (ops vc4_hdmi_ops) vc4-drm soc:gpu: bound 3f806000.vec (ops vc4_vec_ops) vc4-drm soc:gpu: bound 3f004000.txp (ops vc4_txp_ops) vc4-drm soc:gpu: bound 3f400000.hvs (ops vc4_hvs_ops) vc4-drm soc:gpu: bound 3f206000.pixelvalve (ops vc4_crtc_ops) vc4-drm soc:gpu: bound 3f207000.pixelvalve (ops vc4_crtc_ops) vc4-drm soc:gpu: bound 3f807000.pixelvalve (ops vc4_crtc_ops) vc4-drm soc:gpu: bound 3fc00000.v3d (ops vc4_v3d_ops) > 2) Let say that vc4 hdmi driver defers after the registration of the 2nd > component (/drivers/gpu/drm/vc4/vc4-hdmi.c:1082). The devm callback of > the 2nd component will run first and call > snd_soc_unregister_component(). The catch is that this function > unregisters all the components registered by the linux device so far. > > 3) Then the devm callback of the dma_engine will run > snd_dmaengine_pcm_unregister() > (sound/soc/soc-generic-dmaengine-pcm.c:466) and the lookup will not find > the component dmaengine component since it is already unregistered. The > function bails out and dmaengine_pcm_release_chan() is not run. > > 4) Next time the hdmi driver tries to probe, the it will fail to > allocate the DMA channel because the sysfs entry already exists. > > I would suspect that any driver doing: > 1) devm_snd_dmaengine_pcm_register() > 2) devm_snd_soc_register_component() > could be exposed to this issue, even before this patch. > I don't really get is triggering the issue in this change. > > Maybe it would be better if the devm callback of > devm_snd_soc_register_component() unregistered only the related component. > ... Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [alsa-devel] Applied "ASoC: core: ensure component names are unique" to the asoc tree 2020-02-17 14:36 ` Marek Szyprowski @ 2020-02-17 17:23 ` Stefan Wahren 2020-02-17 18:06 ` [RFT/DONTMERGE] ASoC: devm_snd_soc_register_component fixup Jerome Brunet 1 sibling, 0 replies; 12+ messages in thread From: Stefan Wahren @ 2020-02-17 17:23 UTC (permalink / raw) To: Marek Szyprowski, Jerome Brunet, Mark Brown Cc: linux-kernel, alsa-devel, Liam Girdwood, Nicolas Saenz Julienne, linux-rpi-kernel Am 17.02.20 um 15:36 schrieb Marek Szyprowski: > Hi Jerome, > > On 17.02.2020 14:18, Jerome Brunet wrote: >> On Mon 17 Feb 2020 at 13:13, Marek Szyprowski <m.szyprowski@samsung.com> wrote: >>> On 14.02.2020 21:56, Mark Brown wrote: >>>> Thanks, >>>> Mark >>>> >>>> From b2354e4009a773c00054b964d937e1b81cb92078 Mon Sep 17 00:00:00 2001 >>>> From: Jerome Brunet <jbrunet@baylibre.com> >>>> Date: Fri, 14 Feb 2020 14:47:04 +0100 >>>> Subject: [PATCH] ASoC: core: ensure component names are unique >>>> >>>> Make sure each ASoC component is registered with a unique name. >>>> The component is derived from the device name. If a device registers more >>>> than one component, the component names will be the same. >>>> >>>> This usually brings up a warning about the debugfs directory creation of >>>> the component since directory already exists. >>>> >>>> In such case, start numbering the component of the device so the names >>>> don't collide anymore. >>>> >>>> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> >>>> Link: https://lore.kernel.org/r/20200214134704.342501-1-jbrunet@baylibre.com >>>> Signed-off-by: Mark Brown <broonie@kernel.org> >>> This patch landed in today's linux-next and I've noticed that it breaks >>> registration of VC4 DRM driver on Raspberry Pi3 boards (I've compiled >>> kernel from bcm2835_defconfig): >> I think I have an idea about what is going on. (good catch in the defer BTW) >> >> 1) Funny to see that the vc4-hdmi already registers several (3) ASoC >> components. It must have had warning about the debugfs entry before this patch. > Okay, right, before this patch there is a warning from debugfs I've > missed (debugfs was not enabled in bcm2835_defconfig): This is unintended. I've seen patches which restored DEBUG_FS support because of this commit: 0e4a459f56c32d tracing: Remove unnecessary DEBUG_FS dependency Best regards Stefan _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 12+ messages in thread
* [RFT/DONTMERGE] ASoC: devm_snd_soc_register_component fixup 2020-02-17 14:36 ` Marek Szyprowski 2020-02-17 17:23 ` Stefan Wahren @ 2020-02-17 18:06 ` Jerome Brunet 2020-02-18 6:47 ` Marek Szyprowski 1 sibling, 1 reply; 12+ messages in thread From: Jerome Brunet @ 2020-02-17 18:06 UTC (permalink / raw) To: Marek Szyprowski, Mark Brown Cc: linux-kernel, alsa-devel, Liam Girdwood, linux-rpi-kernel, Jerome Brunet Hi Marek, would you mind trying the following patch. It should target the component removal intead of removing them all. I'd like to comfirm this is your problem before pushing in this direction. Thanks Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> --- include/sound/soc.h | 1 + sound/soc/soc-core.c | 8 +++++++ sound/soc/soc-devres.c | 32 ++++++++++++++++++--------- sound/soc/soc-generic-dmaengine-pcm.c | 2 +- 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index f0e4f36f83bf..e5bfe2609110 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -442,6 +442,7 @@ int snd_soc_add_component(struct device *dev, const struct snd_soc_component_driver *component_driver, struct snd_soc_dai_driver *dai_drv, int num_dai); +void snd_soc_del_component(struct snd_soc_component *component); int snd_soc_register_component(struct device *dev, const struct snd_soc_component_driver *component_driver, struct snd_soc_dai_driver *dai_drv, int num_dai); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 6a58a8f6e3c4..bf6a64fbfa52 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2599,6 +2599,14 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component) list_del(&component->list); } +void snd_soc_del_component(struct snd_soc_component *component) +{ + mutex_lock(&client_mutex); + snd_soc_del_component_unlocked(component); + mutex_unlock(&client_mutex); +} +EXPORT_SYMBOL_GPL(snd_soc_del_component); + int snd_soc_add_component(struct device *dev, struct snd_soc_component *component, const struct snd_soc_component_driver *component_driver, diff --git a/sound/soc/soc-devres.c b/sound/soc/soc-devres.c index a9ea172a66a7..d5e9e2bed2ce 100644 --- a/sound/soc/soc-devres.c +++ b/sound/soc/soc-devres.c @@ -11,7 +11,7 @@ static void devm_component_release(struct device *dev, void *res) { - snd_soc_unregister_component(*(struct device **)res); + snd_soc_del_component(*(struct snd_soc_component **)res); } /** @@ -28,21 +28,31 @@ int devm_snd_soc_register_component(struct device *dev, const struct snd_soc_component_driver *cmpnt_drv, struct snd_soc_dai_driver *dai_drv, int num_dai) { - struct device **ptr; - int ret; + struct snd_soc_component *component; + struct snd_soc_component **ptr; + int ret = -ENOMEM; + + component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL); + if (!component) + return -ENOMEM; ptr = devres_alloc(devm_component_release, sizeof(*ptr), GFP_KERNEL); if (!ptr) - return -ENOMEM; + goto err_devres; - ret = snd_soc_register_component(dev, cmpnt_drv, dai_drv, num_dai); - if (ret == 0) { - *ptr = dev; - devres_add(dev, ptr); - } else { - devres_free(ptr); - } + ret = snd_soc_add_component(dev, component, cmpnt_drv, dai_drv, + num_dai); + if (ret) + goto err_add; + + *ptr = component; + devres_add(dev, ptr); + return 0; +err_add: + devres_free(ptr); +err_devres: + devm_kfree(dev, component); return ret; } EXPORT_SYMBOL_GPL(devm_snd_soc_register_component); diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index 2cc25651661c..a33f21ce2d7a 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c @@ -474,7 +474,7 @@ void snd_dmaengine_pcm_unregister(struct device *dev) pcm = soc_component_to_pcm(component); - snd_soc_unregister_component(dev); + snd_soc_del_component(component); dmaengine_pcm_release_chan(pcm); kfree(pcm); } -- 2.24.1 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [RFT/DONTMERGE] ASoC: devm_snd_soc_register_component fixup 2020-02-17 18:06 ` [RFT/DONTMERGE] ASoC: devm_snd_soc_register_component fixup Jerome Brunet @ 2020-02-18 6:47 ` Marek Szyprowski 2020-02-18 9:32 ` Jerome Brunet 0 siblings, 1 reply; 12+ messages in thread From: Marek Szyprowski @ 2020-02-18 6:47 UTC (permalink / raw) To: Jerome Brunet, Mark Brown Cc: alsa-devel, Liam Girdwood, linux-rpi-kernel, linux-kernel Hi Jerome, On 17.02.2020 19:06, Jerome Brunet wrote: > Hi Marek, would you mind trying the following patch. It should target the > component removal intead of removing them all. I'd like to comfirm this is > your problem before pushing in this direction. Thanks > > Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> It helps a bit. There is no warning from sysfs, but vc4-drm is still not registered properly: raspberrypi-firmware soc:firmware: Attached to firmware from 2019-07-09 14:40 raspberrypi-clk raspberrypi-clk: CPU frequency range: min 600000000, max 1200000000 vc4_hdmi 3f902000.hdmi: ASoC: CODEC DAI vc4-hdmi-hifi not registered vc4_hdmi 3f902000.hdmi: Could not register sound card: -517 vc4-drm soc:gpu: failed to bind 3f902000.hdmi (ops vc4_hdmi_ops): -517 vc4-drm soc:gpu: master bind failed: -517 > --- > include/sound/soc.h | 1 + > sound/soc/soc-core.c | 8 +++++++ > sound/soc/soc-devres.c | 32 ++++++++++++++++++--------- > sound/soc/soc-generic-dmaengine-pcm.c | 2 +- > 4 files changed, 31 insertions(+), 12 deletions(-) > > diff --git a/include/sound/soc.h b/include/sound/soc.h > index f0e4f36f83bf..e5bfe2609110 100644 > --- a/include/sound/soc.h > +++ b/include/sound/soc.h > @@ -442,6 +442,7 @@ int snd_soc_add_component(struct device *dev, > const struct snd_soc_component_driver *component_driver, > struct snd_soc_dai_driver *dai_drv, > int num_dai); > +void snd_soc_del_component(struct snd_soc_component *component); > int snd_soc_register_component(struct device *dev, > const struct snd_soc_component_driver *component_driver, > struct snd_soc_dai_driver *dai_drv, int num_dai); > diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c > index 6a58a8f6e3c4..bf6a64fbfa52 100644 > --- a/sound/soc/soc-core.c > +++ b/sound/soc/soc-core.c > @@ -2599,6 +2599,14 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component) > list_del(&component->list); > } > > +void snd_soc_del_component(struct snd_soc_component *component) > +{ > + mutex_lock(&client_mutex); > + snd_soc_del_component_unlocked(component); > + mutex_unlock(&client_mutex); > +} > +EXPORT_SYMBOL_GPL(snd_soc_del_component); > + > int snd_soc_add_component(struct device *dev, > struct snd_soc_component *component, > const struct snd_soc_component_driver *component_driver, > diff --git a/sound/soc/soc-devres.c b/sound/soc/soc-devres.c > index a9ea172a66a7..d5e9e2bed2ce 100644 > --- a/sound/soc/soc-devres.c > +++ b/sound/soc/soc-devres.c > @@ -11,7 +11,7 @@ > > static void devm_component_release(struct device *dev, void *res) > { > - snd_soc_unregister_component(*(struct device **)res); > + snd_soc_del_component(*(struct snd_soc_component **)res); > } > > /** > @@ -28,21 +28,31 @@ int devm_snd_soc_register_component(struct device *dev, > const struct snd_soc_component_driver *cmpnt_drv, > struct snd_soc_dai_driver *dai_drv, int num_dai) > { > - struct device **ptr; > - int ret; > + struct snd_soc_component *component; > + struct snd_soc_component **ptr; > + int ret = -ENOMEM; > + > + component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL); > + if (!component) > + return -ENOMEM; > > ptr = devres_alloc(devm_component_release, sizeof(*ptr), GFP_KERNEL); > if (!ptr) > - return -ENOMEM; > + goto err_devres; > > - ret = snd_soc_register_component(dev, cmpnt_drv, dai_drv, num_dai); > - if (ret == 0) { > - *ptr = dev; > - devres_add(dev, ptr); > - } else { > - devres_free(ptr); > - } > + ret = snd_soc_add_component(dev, component, cmpnt_drv, dai_drv, > + num_dai); > + if (ret) > + goto err_add; > + > + *ptr = component; > + devres_add(dev, ptr); > + return 0; > > +err_add: > + devres_free(ptr); > +err_devres: > + devm_kfree(dev, component); > return ret; > } > EXPORT_SYMBOL_GPL(devm_snd_soc_register_component); > diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c > index 2cc25651661c..a33f21ce2d7a 100644 > --- a/sound/soc/soc-generic-dmaengine-pcm.c > +++ b/sound/soc/soc-generic-dmaengine-pcm.c > @@ -474,7 +474,7 @@ void snd_dmaengine_pcm_unregister(struct device *dev) > > pcm = soc_component_to_pcm(component); > > - snd_soc_unregister_component(dev); > + snd_soc_del_component(component); > dmaengine_pcm_release_chan(pcm); > kfree(pcm); > } Best regards -- Marek Szyprowski, PhD Samsung R&D Institute Poland ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [RFT/DONTMERGE] ASoC: devm_snd_soc_register_component fixup 2020-02-18 6:47 ` Marek Szyprowski @ 2020-02-18 9:32 ` Jerome Brunet 0 siblings, 0 replies; 12+ messages in thread From: Jerome Brunet @ 2020-02-18 9:32 UTC (permalink / raw) To: Marek Szyprowski, Mark Brown Cc: alsa-devel, Liam Girdwood, linux-rpi-kernel, linux-kernel On Tue 18 Feb 2020 at 07:47, Marek Szyprowski <m.szyprowski@samsung.com> wrote: > Hi Jerome, > > On 17.02.2020 19:06, Jerome Brunet wrote: >> Hi Marek, would you mind trying the following patch. It should target the >> component removal intead of removing them all. I'd like to comfirm this is >> your problem before pushing in this direction. Thanks >> >> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> > > It helps a bit. There is no warning from sysfs, but vc4-drm is still not > registered properly: > > raspberrypi-firmware soc:firmware: Attached to firmware from 2019-07-09 > 14:40 > raspberrypi-clk raspberrypi-clk: CPU frequency range: min 600000000, max > 1200000000 > vc4_hdmi 3f902000.hdmi: ASoC: CODEC DAI vc4-hdmi-hifi not registered > vc4_hdmi 3f902000.hdmi: Could not register sound card: -517 > vc4-drm soc:gpu: failed to bind 3f902000.hdmi (ops vc4_hdmi_ops): -517 > vc4-drm soc:gpu: master bind failed: -517 It explains why the original patch of this thread triggered the issue. The problem is at drivers/gpu/drm/vc4/vc4-hdmi.c:1108 The driver derives the component name directly from the device name and assume all 3 components have the same name. This is not ideal: * We seen that debugfs was already warning about the name collision * ASoC should be allowed to set the name With this patch, the component name of the 2nd and 3rd component changed but the name claimed by the card driver remain unchanged which is why the card probe defers. This particular issue can probably be solved with lookup of the component name instead of a direct derivation. I'll check. > >> --- >> include/sound/soc.h | 1 + >> sound/soc/soc-core.c | 8 +++++++ >> sound/soc/soc-devres.c | 32 ++++++++++++++++++--------- >> sound/soc/soc-generic-dmaengine-pcm.c | 2 +- >> 4 files changed, 31 insertions(+), 12 deletions(-) >> >> diff --git a/include/sound/soc.h b/include/sound/soc.h >> index f0e4f36f83bf..e5bfe2609110 100644 >> --- a/include/sound/soc.h >> +++ b/include/sound/soc.h >> @@ -442,6 +442,7 @@ int snd_soc_add_component(struct device *dev, >> const struct snd_soc_component_driver *component_driver, >> struct snd_soc_dai_driver *dai_drv, >> int num_dai); >> +void snd_soc_del_component(struct snd_soc_component *component); >> int snd_soc_register_component(struct device *dev, >> const struct snd_soc_component_driver *component_driver, >> struct snd_soc_dai_driver *dai_drv, int num_dai); >> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c >> index 6a58a8f6e3c4..bf6a64fbfa52 100644 >> --- a/sound/soc/soc-core.c >> +++ b/sound/soc/soc-core.c >> @@ -2599,6 +2599,14 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component) >> list_del(&component->list); >> } >> >> +void snd_soc_del_component(struct snd_soc_component *component) >> +{ >> + mutex_lock(&client_mutex); >> + snd_soc_del_component_unlocked(component); >> + mutex_unlock(&client_mutex); >> +} >> +EXPORT_SYMBOL_GPL(snd_soc_del_component); >> + >> int snd_soc_add_component(struct device *dev, >> struct snd_soc_component *component, >> const struct snd_soc_component_driver *component_driver, >> diff --git a/sound/soc/soc-devres.c b/sound/soc/soc-devres.c >> index a9ea172a66a7..d5e9e2bed2ce 100644 >> --- a/sound/soc/soc-devres.c >> +++ b/sound/soc/soc-devres.c >> @@ -11,7 +11,7 @@ >> >> static void devm_component_release(struct device *dev, void *res) >> { >> - snd_soc_unregister_component(*(struct device **)res); >> + snd_soc_del_component(*(struct snd_soc_component **)res); >> } >> >> /** >> @@ -28,21 +28,31 @@ int devm_snd_soc_register_component(struct device *dev, >> const struct snd_soc_component_driver *cmpnt_drv, >> struct snd_soc_dai_driver *dai_drv, int num_dai) >> { >> - struct device **ptr; >> - int ret; >> + struct snd_soc_component *component; >> + struct snd_soc_component **ptr; >> + int ret = -ENOMEM; >> + >> + component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL); >> + if (!component) >> + return -ENOMEM; >> >> ptr = devres_alloc(devm_component_release, sizeof(*ptr), GFP_KERNEL); >> if (!ptr) >> - return -ENOMEM; >> + goto err_devres; >> >> - ret = snd_soc_register_component(dev, cmpnt_drv, dai_drv, num_dai); >> - if (ret == 0) { >> - *ptr = dev; >> - devres_add(dev, ptr); >> - } else { >> - devres_free(ptr); >> - } >> + ret = snd_soc_add_component(dev, component, cmpnt_drv, dai_drv, >> + num_dai); >> + if (ret) >> + goto err_add; >> + >> + *ptr = component; >> + devres_add(dev, ptr); >> + return 0; >> >> +err_add: >> + devres_free(ptr); >> +err_devres: >> + devm_kfree(dev, component); >> return ret; >> } >> EXPORT_SYMBOL_GPL(devm_snd_soc_register_component); >> diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c >> index 2cc25651661c..a33f21ce2d7a 100644 >> --- a/sound/soc/soc-generic-dmaengine-pcm.c >> +++ b/sound/soc/soc-generic-dmaengine-pcm.c >> @@ -474,7 +474,7 @@ void snd_dmaengine_pcm_unregister(struct device *dev) >> >> pcm = soc_component_to_pcm(component); >> >> - snd_soc_unregister_component(dev); >> + snd_soc_del_component(component); >> dmaengine_pcm_release_chan(pcm); >> kfree(pcm); >> } > > Best regards ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [alsa-devel] Applied "ASoC: core: ensure component names are unique" to the asoc tree 2020-02-17 12:13 ` Marek Szyprowski 2020-02-17 13:18 ` Jerome Brunet @ 2020-02-17 13:22 ` Peter Ujfalusi 1 sibling, 0 replies; 12+ messages in thread From: Peter Ujfalusi @ 2020-02-17 13:22 UTC (permalink / raw) To: Marek Szyprowski, Mark Brown, Jerome Brunet, Vinod, Geert Uytterhoeven Cc: dmaengine, linux-kernel, alsa-devel, Liam Girdwood, linux-rpi-kernel Hi, On 17/02/2020 14.13, Marek Szyprowski wrote: > Dear All, Adding Vinod and Geert + dmaengine list > > On 14.02.2020 21:56, Mark Brown wrote: >> The patch >> >> ASoC: core: ensure component names are unique >> >> has been applied to the asoc tree at >> >> https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git >> >> 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 b2354e4009a773c00054b964d937e1b81cb92078 Mon Sep 17 00:00:00 2001 >> From: Jerome Brunet <jbrunet@baylibre.com> >> Date: Fri, 14 Feb 2020 14:47:04 +0100 >> Subject: [PATCH] ASoC: core: ensure component names are unique >> >> Make sure each ASoC component is registered with a unique name. >> The component is derived from the device name. If a device registers more >> than one component, the component names will be the same. >> >> This usually brings up a warning about the debugfs directory creation of >> the component since directory already exists. >> >> In such case, start numbering the component of the device so the names >> don't collide anymore. >> >> Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> >> Link: https://lore.kernel.org/r/20200214134704.342501-1-jbrunet@baylibre.com >> Signed-off-by: Mark Brown <broonie@kernel.org> > > This patch landed in today's linux-next and I've noticed that it breaks > registration of VC4 DRM driver on Raspberry Pi3 boards (I've compiled > kernel from bcm2835_defconfig): > > sysfs: cannot create duplicate filename > '/devices/platform/soc/3f902000.hdmi/dma:audio-rx' It looks like that DMAengine tries to create the same link multiple times? I'm not sure why reverting this patch fixes the issue... - Péter > CPU: 0 PID: 67 Comm: kworker/0:2 Tainted: G W > 5.6.0-rc2-next-20200217 #314 > Hardware name: BCM2835 > Workqueue: events deferred_probe_work_func > Backtrace: > [<c010c424>] (dump_backtrace) from [<c010c8a8>] (show_stack+0x20/0x24) > r7:eb73d5c0 r6:eb53a8f0 r5:eb73d5c0 r4:eb4d3000 > [<c010c888>] (show_stack) from [<c080ad40>] (dump_stack+0x20/0x28) > [<c080ad20>] (dump_stack) from [<c02be6e0>] (sysfs_warn_dup+0x60/0x74) > [<c02be680>] (sysfs_warn_dup) from [<c02bea00>] > (sysfs_do_create_link_sd+0xa4/0xc0) > r7:eb73d5c0 r6:eb53a8f0 r5:eb6becb8 r4:ffffffef > [<c02be95c>] (sysfs_do_create_link_sd) from [<c02beb68>] > (sysfs_create_link+0x34/0x44) > r9:eb698c40 r8:c093e47c r7:00000000 r6:eb537e10 r5:eb6f9900 r4:eb537e10 > [<c02beb34>] (sysfs_create_link) from [<c0415afc>] > (dma_request_chan+0x1b8/0x208) > [<c0415944>] (dma_request_chan) from [<c05f25a0>] > (snd_dmaengine_pcm_register+0xf4/0x1bc) > r10:c0963460 r9:eb537e10 r8:c093e47c r7:00000000 r6:eb537e10 r5:eb6f9900 > r4:c093e468 > [<c05f24ac>] (snd_dmaengine_pcm_register) from [<c05f0ebc>] > (devm_snd_dmaengine_pcm_register+0x4c/0x84) > r10:eb715c4c r9:c093e3d4 r8:eb537e00 r7:00000000 r6:eb537e10 r5:eb7ca240 > r4:c093e468 > [<c05f0e70>] (devm_snd_dmaengine_pcm_register) from [<c0492dc0>] > (vc4_hdmi_bind+0x3a8/0x590) > r7:eb537e10 r6:eb537e10 r5:eb715440 r4:eb715c40 > [<c0492a18>] (vc4_hdmi_bind) from [<c049b6e0>] > (component_bind_all+0x128/0x238) > r10:eb7267c0 r9:00000008 r8:eb73f800 r7:00000018 r6:00000000 r5:eb7016c0 > r4:eb6c9240 > [<c049b5b8>] (component_bind_all) from [<c048c150>] > (vc4_drm_bind+0xe4/0x17c) > r9:00000008 r8:eb6c88c0 r7:eb6a2840 r6:eb53b210 r5:00000000 r4:eb73f800 > [<c048c06c>] (vc4_drm_bind) from [<c049adc8>] > (try_to_bring_up_master+0x190/0x264) > r7:eb6a2840 r6:000000a8 r5:eb7267c0 r4:eb6c9240 > [<c049ac38>] (try_to_bring_up_master) from [<c049b13c>] > (__component_add+0x80/0x114) > r10:c0d57488 r9:00000012 r8:00000000 r7:eb6c9240 r6:c093e924 r5:c0d572f8 > r4:eb7267c0 > [<c049b0bc>] (__component_add) from [<c049b1ec>] (component_add+0x1c/0x20) > r7:c0d56f7c r6:c0d56f7c r5:eb534a10 r4:00000000 > [<c049b1d0>] (component_add) from [<c0493864>] (vc4_vec_dev_probe+0x20/0x28) > [<c0493844>] (vc4_vec_dev_probe) from [<c04a43a4>] > (platform_drv_probe+0x58/0xa8) > [<c04a434c>] (platform_drv_probe) from [<c04a2298>] > (really_probe+0x1a8/0x428) > r7:c0d56f7c r6:00000000 r5:c0e579b8 r4:eb534a10 > [<c04a20f0>] (really_probe) from [<c04a2840>] > (driver_probe_device+0x158/0x1ac) > r9:00000000 r8:00000001 r7:eb70fe9c r6:c0d56f7c r5:c0d56f7c r4:eb534a10 > [<c04a26e8>] (driver_probe_device) from [<c04a2a40>] > (__device_attach_driver+0xb0/0xf8) > r9:00000000 r8:00000001 r7:eb70fe9c r6:c0d56f7c r5:eb534a10 r4:00000001 > [<c04a2990>] (__device_attach_driver) from [<c04a0408>] > (bus_for_each_drv+0xa0/0xc8) > r7:c04a2990 r6:eb70fe9c r5:c0d04248 r4:00000000 > [<c04a0368>] (bus_for_each_drv) from [<c04a25bc>] > (__device_attach+0xa4/0x158) > r7:eb534a54 r6:c0d04248 r5:c0d576a8 r4:eb534a10 > [<c04a2518>] (__device_attach) from [<c04a2aa4>] > (device_initial_probe+0x1c/0x20) > r8:eb9c7300 r7:00000000 r6:eb534a10 r5:c0d576a8 r4:eb534a10 > [<c04a2a88>] (device_initial_probe) from [<c04a12d4>] > (bus_probe_device+0x38/0x90) > [<c04a129c>] (bus_probe_device) from [<c04a1848>] > (deferred_probe_work_func+0x70/0xb0) > r7:00000000 r6:c0d57478 r5:c0d5746c r4:eb534a10 > [<c04a17d8>] (deferred_probe_work_func) from [<c0135a50>] > (process_one_work+0x1a8/0x2ac) > r7:00000000 r6:c0d0c8a4 r5:c0d57484 r4:eb6ed880 > [<c01358a8>] (process_one_work) from [<c0136ddc>] > (worker_thread+0x1f0/0x2e8) > r10:00000000 r9:c0d156e0 r8:c0d0c8b8 r7:c0d156e0 r6:c0d0c8a4 r5:eb6ed894 > r4:eb6ed880 > [<c0136bec>] (worker_thread) from [<c013b5a0>] (kthread+0x120/0x130) > r10:00000000 r9:eb6f5018 r8:eb4e9e98 r7:c0136bec r6:eb6ed880 r5:eb6e6b40 > r4:eb6f5000 r3:00000000 > [<c013b480>] (kthread) from [<c01010e8>] (ret_from_fork+0x14/0x2c) > Exception stack(0xeb70ffb0 to 0xeb70fff8) > ffa0: 00000000 00000000 00000000 > 00000000 > ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 > 00000000 > ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 > r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c013b480 r4:eb6e6b40 > vc4_hdmi 3f902000.hdmi: Cannot create DMA dma:audio-rx symlink > vc4_hdmi 3f902000.hdmi: ASoC: CODEC DAI vc4-hdmi-hifi not registered > vc4_hdmi 3f902000.hdmi: Could not register sound card: -517 > vc4-drm soc:gpu: failed to bind 3f902000.hdmi (ops vc4_hdmi_ops): -517 > vc4-drm soc:gpu: master bind failed: -517 > > Reverting this patch fixes vc4-drm driver registration and > initialization. If I find some spare time I will debug this issue > further, but it looks that it is somehow related to deferred probe. > > >> --- >> sound/soc/soc-core.c | 29 ++++++++++++++++++++++++++++- >> 1 file changed, 28 insertions(+), 1 deletion(-) >> >> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c >> index 03b87427faa7..6a58a8f6e3c4 100644 >> --- a/sound/soc/soc-core.c >> +++ b/sound/soc/soc-core.c >> @@ -2446,6 +2446,33 @@ static int snd_soc_register_dais(struct snd_soc_component *component, >> return ret; >> } >> >> +static char *snd_soc_component_unique_name(struct device *dev, >> + struct snd_soc_component *component) >> +{ >> + struct snd_soc_component *pos; >> + int count = 0; >> + char *name, *unique; >> + >> + name = fmt_single_name(dev, &component->id); >> + if (!name) >> + return name; >> + >> + /* Count the number of components registred by the device */ >> + for_each_component(pos) { >> + if (dev == pos->dev) >> + count++; >> + } >> + >> + /* Keep naming as it is for the 1st component */ >> + if (!count) >> + return name; >> + >> + unique = devm_kasprintf(dev, GFP_KERNEL, "%s-%d", name, count); >> + devm_kfree(dev, name); >> + >> + return unique; >> +} >> + >> static int snd_soc_component_initialize(struct snd_soc_component *component, >> const struct snd_soc_component_driver *driver, struct device *dev) >> { >> @@ -2454,7 +2481,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component, >> INIT_LIST_HEAD(&component->card_list); >> mutex_init(&component->io_mutex); >> >> - component->name = fmt_single_name(dev, &component->id); >> + component->name = snd_soc_component_unique_name(dev, component); >> if (!component->name) { >> dev_err(dev, "ASoC: Failed to allocate name\n"); >> return -ENOMEM; > > Best regards > Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Applied "ASoC: core: ensure component names are unique" to the asoc tree 2020-02-14 20:56 ` [alsa-devel] Applied "ASoC: core: ensure component names are unique" to the asoc tree Mark Brown [not found] ` <CGME20200217121336eucas1p2deb35417f5c4646a89762fd6146c3cf9@eucas1p2.samsung.com> @ 2020-02-18 18:55 ` Jerome Brunet 2020-02-18 19:03 ` Mark Brown 1 sibling, 1 reply; 12+ messages in thread From: Jerome Brunet @ 2020-02-18 18:55 UTC (permalink / raw) To: Mark Brown; +Cc: alsa-devel, Liam Girdwood, linux-kernel On Fri 14 Feb 2020 at 21:56, Mark Brown <broonie@kernel.org> wrote: > The patch > > ASoC: core: ensure component names are unique > > has been applied to the asoc tree at > > https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git > > 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 Hi Mark, Short Version: After looking at the problem reported by Marek, I think the best course of action for now is to revert b2354e4009a7 ("ASoC: core: ensure component names are unique") while working on a solution. It might take some time. Longer Version: 1) Multiple components : I found out that in fact it is common for linux devices to register multiple components. For most, it is a combination of the dmaengine generic and the actual device component, but other register more component. Ex: - vc4-hdmi - atmel-classd - atmel-pdmic - cros-ec-codec - mtXXXX-afe-pcm I suspect these trigger the debugfs warning Even dummy register two components :D All devices using devm_snd_dmaengine_pcm_register() and devm_snd_soc_register_component() are exposed to clean-up issue in case of deferral. That's because snd_soc_unregister_component() unregisters all the components registered the device. I suppose there might be other problems when using the devm API with this function. 2) Fixed component names: Several card driver assume the component name is the device name and won't query the actual component name or node. Ex: - sun4i-codec - omap-hdmi - vc4-hdmi - sof-nocodec So changing the way ASoC generate the component names might break these cards. It gets tricky because the same cards driver might register multiple component themselves, like vc4-hdmi. > > From b2354e4009a773c00054b964d937e1b81cb92078 Mon Sep 17 00:00:00 2001 > From: Jerome Brunet <jbrunet@baylibre.com> > Date: Fri, 14 Feb 2020 14:47:04 +0100 > Subject: [PATCH] ASoC: core: ensure component names are unique > > Make sure each ASoC component is registered with a unique name. > The component is derived from the device name. If a device registers more > than one component, the component names will be the same. > > This usually brings up a warning about the debugfs directory creation of > the component since directory already exists. > > In such case, start numbering the component of the device so the names > don't collide anymore. > > Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> > Link: https://lore.kernel.org/r/20200214134704.342501-1-jbrunet@baylibre.com > Signed-off-by: Mark Brown <broonie@kernel.org> > --- > sound/soc/soc-core.c | 29 ++++++++++++++++++++++++++++- > 1 file changed, 28 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c > index 03b87427faa7..6a58a8f6e3c4 100644 > --- a/sound/soc/soc-core.c > +++ b/sound/soc/soc-core.c > @@ -2446,6 +2446,33 @@ static int snd_soc_register_dais(struct snd_soc_component *component, > return ret; > } > > +static char *snd_soc_component_unique_name(struct device *dev, > + struct snd_soc_component *component) > +{ > + struct snd_soc_component *pos; > + int count = 0; > + char *name, *unique; > + > + name = fmt_single_name(dev, &component->id); > + if (!name) > + return name; > + > + /* Count the number of components registred by the device */ > + for_each_component(pos) { > + if (dev == pos->dev) > + count++; > + } > + > + /* Keep naming as it is for the 1st component */ > + if (!count) > + return name; > + > + unique = devm_kasprintf(dev, GFP_KERNEL, "%s-%d", name, count); > + devm_kfree(dev, name); > + > + return unique; > +} > + > static int snd_soc_component_initialize(struct snd_soc_component *component, > const struct snd_soc_component_driver *driver, struct device *dev) > { > @@ -2454,7 +2481,7 @@ static int snd_soc_component_initialize(struct snd_soc_component *component, > INIT_LIST_HEAD(&component->card_list); > mutex_init(&component->io_mutex); > > - component->name = fmt_single_name(dev, &component->id); > + component->name = snd_soc_component_unique_name(dev, component); > if (!component->name) { > dev_err(dev, "ASoC: Failed to allocate name\n"); > return -ENOMEM; ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Applied "ASoC: core: ensure component names are unique" to the asoc tree 2020-02-18 18:55 ` Jerome Brunet @ 2020-02-18 19:03 ` Mark Brown 0 siblings, 0 replies; 12+ messages in thread From: Mark Brown @ 2020-02-18 19:03 UTC (permalink / raw) To: Jerome Brunet; +Cc: alsa-devel, Liam Girdwood, linux-kernel [-- Attachment #1: Type: text/plain, Size: 904 bytes --] On Tue, Feb 18, 2020 at 07:55:31PM +0100, Jerome Brunet wrote: > 1) Multiple components : > I found out that in fact it is common for linux devices to register > multiple components. For most, it is a combination of the dmaengine > generic and the actual device component, but other register more > component. Ex: > - vc4-hdmi > - atmel-classd > - atmel-pdmic > - cros-ec-codec > - mtXXXX-afe-pcm > I suspect these trigger the debugfs warning > Even dummy register two components :D I hadn't realized we have so many - I'd have expected the debugfs complaints would've been noticable to people, I was hoping based on the initial discussion that it was just a couple of quick fixed needed. Guess not :/ Anyway, I agree that a revert is probably sensible for the time being and getting this done is more involved - can you send patches doing the revert with a changelog explaining the rationale please? [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 488 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2020-02-18 19:04 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-02-14 13:47 [alsa-devel] [PATCH RFC] ASoC: core: ensure component names are unique Jerome Brunet 2020-02-14 20:56 ` [alsa-devel] Applied "ASoC: core: ensure component names are unique" to the asoc tree Mark Brown [not found] ` <CGME20200217121336eucas1p2deb35417f5c4646a89762fd6146c3cf9@eucas1p2.samsung.com> 2020-02-17 12:13 ` Marek Szyprowski 2020-02-17 13:18 ` Jerome Brunet 2020-02-17 14:36 ` Marek Szyprowski 2020-02-17 17:23 ` Stefan Wahren 2020-02-17 18:06 ` [RFT/DONTMERGE] ASoC: devm_snd_soc_register_component fixup Jerome Brunet 2020-02-18 6:47 ` Marek Szyprowski 2020-02-18 9:32 ` Jerome Brunet 2020-02-17 13:22 ` [alsa-devel] Applied "ASoC: core: ensure component names are unique" to the asoc tree Peter Ujfalusi 2020-02-18 18:55 ` Jerome Brunet 2020-02-18 19:03 ` Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).