Skip to content

Commit d462f6e

Browse files
hkallweitbroonie
authored andcommitted
ASoC: soc-core: add debugfs_prefix member to snd_soc_component_driver
Allow the component debugfs_prefix to be set from snd_soc_component_driver. First use case is avoiding a duplicate debugfs entry error in case a device has multiple components which have the same name therefore. Note that we don't set component->debugfs_prefix if it's set already. That's needed because partially component->debugfs_prefix is set before calling snd_soc_component_initialize(). Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Link: https://lore.kernel.org/r/d18bff6a-1df1-5f95-0cf8-10dbaa62d7be@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 0b3d5d2 commit d462f6e

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

include/sound/soc-component.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,10 @@ struct snd_soc_component_driver {
179179
struct snd_pcm_hw_params *params);
180180
bool use_dai_pcm_id; /* use DAI link PCM ID as PCM device number */
181181
int be_pcm_base; /* base device ID for all BE PCMs */
182+
183+
#ifdef CONFIG_DEBUG_FS
184+
const char *debugfs_prefix;
185+
#endif
182186
};
183187

184188
struct snd_soc_component {

sound/soc/soc-core.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2587,6 +2587,11 @@ int snd_soc_component_initialize(struct snd_soc_component *component,
25872587
component->dev = dev;
25882588
component->driver = driver;
25892589

2590+
#ifdef CONFIG_DEBUG_FS
2591+
if (!component->debugfs_prefix)
2592+
component->debugfs_prefix = driver->debugfs_prefix;
2593+
#endif
2594+
25902595
return 0;
25912596
}
25922597
EXPORT_SYMBOL_GPL(snd_soc_component_initialize);

0 commit comments

Comments
 (0)