Skip to contentSkip to conversation

ASoC: wm_adsp: Fix compilation when debugfs is disabled

PATCH In review Simon Trimmer 2 participants 4 messages Sep 29, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: wm_adsp: Fix compilation when debugfs is disabled

Guard the use of component->debufs_root against CONFIG_DEBUG_FS

---
 sound/soc/codecs/wm_adsp.c | 2 ++
 1 file changed, 2 insertions(+)
sound/soc/codecs/wm_adsp.c +2 -0
index f17c749c24c3..03cfaa82b031 100644
@@ -1028,7 +1028,9 @@ int wm_adsp2_component_probe(struct wm_adsp *dsp, struct snd_soc_component *comp
 	snprintf(preload, ARRAY_SIZE(preload), "%s Preload", dsp->cs_dsp.name);
 	snd_soc_component_disable_pin(component, preload);
 
+#if IS_ENABLED(CONFIG_DEBUG_FS)
 	cs_dsp_init_debugfs(&dsp->cs_dsp, component->debugfs_root);
+#endif
 
 	dsp->component = component;
 
Signature · 1 line
2.33.0
maintainer
#1 lore raw

sound/soc/codecs/wm_adsp.c int wm_adsp2_component_probe(struct wm_adsp *dsp, struct snd_soc_component *comp · line 1033

Quoted 3 lines · Simon Trimmer
sound/soc/codecs/wm_adsp.c +2 -0
+#if IS_ENABLED(CONFIG_DEBUG_FS)
 	cs_dsp_init_debugfs(&dsp->cs_dsp, component->debugfs_root);
+#endif

The more common pattern is to declare a static inline stub function instead of the prototype if debugfs is disabled.

#2 lore raw
Quoted 3 lines · Mark Brown

The more common pattern is to declare a static inline stub function instead of the prototype if debugfs is disabled.

Hi Mark,
Yes there is one for the cs_dsp_init_debugfs function though the compilation failure the bot
detected is with the parameter dereferencing the disappearing snd_soc_component member.

I could make a utility inline for use in this function that would do the dereference or return NULL
based on the state of the config option if you think that would be neater? (For the expense of a
new function it would separate the call of the stub from the conditional access of the member
based on IS_ENABLED)

Thanks,
Simon

maintainer
#3 lore raw
Quoted 4 lines · Simon Trimmer

Yes there is one for the cs_dsp_init_debugfs function though the compilation failure the bot
detected is with the parameter dereferencing the disappearing snd_soc_component member.

At that point just remove the conditional definition in the struct, it's not like a single pointer in a struct we are likely to have well under 10 of in the system is going to make an appreciable difference to memory consumption.