All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: wm_adsp: Fix compilation when debugfs is disabled
@ 2021-09-29 14:50 ` Simon Trimmer
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Trimmer @ 2021-09-29 14:50 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: alsa-devel, patches, linux-kernel, Simon Trimmer, kernel test robot

Guard the use of component->debufs_root against CONFIG_DEBUG_FS

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
---
 sound/soc/codecs/wm_adsp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index f17c749c24c3..03cfaa82b031 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -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;
 
-- 
2.33.0


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

* [PATCH] ASoC: wm_adsp: Fix compilation when debugfs is disabled
@ 2021-09-29 14:50 ` Simon Trimmer
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Trimmer @ 2021-09-29 14:50 UTC (permalink / raw)
  To: broonie, lgirdwood
  Cc: patches, alsa-devel, Simon Trimmer, linux-kernel, kernel test robot

Guard the use of component->debufs_root against CONFIG_DEBUG_FS

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Simon Trimmer <simont@opensource.cirrus.com>
---
 sound/soc/codecs/wm_adsp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index f17c749c24c3..03cfaa82b031 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -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;
 
-- 
2.33.0


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

* Re: [PATCH] ASoC: wm_adsp: Fix compilation when debugfs is disabled
  2021-09-29 14:50 ` Simon Trimmer
@ 2021-09-29 14:52   ` Mark Brown
  -1 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2021-09-29 14:52 UTC (permalink / raw)
  To: Simon Trimmer
  Cc: lgirdwood, alsa-devel, patches, linux-kernel, kernel test robot

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

On Wed, Sep 29, 2021 at 03:50:40PM +0100, Simon Trimmer wrote:

> +#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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] ASoC: wm_adsp: Fix compilation when debugfs is disabled
@ 2021-09-29 14:52   ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2021-09-29 14:52 UTC (permalink / raw)
  To: Simon Trimmer
  Cc: patches, alsa-devel, kernel test robot, lgirdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

On Wed, Sep 29, 2021 at 03:50:40PM +0100, Simon Trimmer wrote:

> +#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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* RE: [PATCH] ASoC: wm_adsp: Fix compilation when debugfs is disabled
  2021-09-29 14:52   ` Mark Brown
@ 2021-09-29 15:27     ` Simon Trimmer
  -1 siblings, 0 replies; 8+ messages in thread
From: Simon Trimmer @ 2021-09-29 15:27 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: lgirdwood, alsa-devel, patches, linux-kernel,
	'kernel test robot'

> On Wednesday, September 29, 2021 3:52 PM, Mark Brown wrote:
> 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


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

* RE: [PATCH] ASoC: wm_adsp: Fix compilation when debugfs is disabled
@ 2021-09-29 15:27     ` Simon Trimmer
  0 siblings, 0 replies; 8+ messages in thread
From: Simon Trimmer @ 2021-09-29 15:27 UTC (permalink / raw)
  To: 'Mark Brown'
  Cc: patches, alsa-devel, 'kernel test robot',
	lgirdwood, linux-kernel

> On Wednesday, September 29, 2021 3:52 PM, Mark Brown wrote:
> 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


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

* Re: [PATCH] ASoC: wm_adsp: Fix compilation when debugfs is disabled
  2021-09-29 15:27     ` Simon Trimmer
@ 2021-09-29 20:35       ` Mark Brown
  -1 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2021-09-29 20:35 UTC (permalink / raw)
  To: Simon Trimmer
  Cc: lgirdwood, alsa-devel, patches, linux-kernel,
	'kernel test robot'

[-- Attachment #1: Type: text/plain, Size: 484 bytes --]

On Wed, Sep 29, 2021 at 04:27:19PM +0100, Simon Trimmer wrote:

> 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH] ASoC: wm_adsp: Fix compilation when debugfs is disabled
@ 2021-09-29 20:35       ` Mark Brown
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Brown @ 2021-09-29 20:35 UTC (permalink / raw)
  To: Simon Trimmer
  Cc: patches, alsa-devel, 'kernel test robot',
	lgirdwood, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 484 bytes --]

On Wed, Sep 29, 2021 at 04:27:19PM +0100, Simon Trimmer wrote:

> 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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2021-09-29 20:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 14:50 [PATCH] ASoC: wm_adsp: Fix compilation when debugfs is disabled Simon Trimmer
2021-09-29 14:50 ` Simon Trimmer
2021-09-29 14:52 ` Mark Brown
2021-09-29 14:52   ` Mark Brown
2021-09-29 15:27   ` Simon Trimmer
2021-09-29 15:27     ` Simon Trimmer
2021-09-29 20:35     ` Mark Brown
2021-09-29 20:35       ` 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.