public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: greybus: audio: Limit scope of jack-related variables
@ 2026-01-20  7:07 Lee Yongjun
  2026-01-20  7:09 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Lee Yongjun @ 2026-01-20  7:07 UTC (permalink / raw)
  To: vaibhav.sr, mgreer, johan, elder, gregkh
  Cc: greybus-dev, linux-staging, linux-kernel, Lee Yongjun

Move jack-related variable declarations inside the CONFIG_SND_JACK
conditional block.

These variables are only used when CONFIG_SND_JACK is enabled, so
limiting their scope improves code clarity and avoids unused variable
warnings when the option is disabled.

No functional changes intended.

Signed-off-by: Lee Yongjun <jun85566@gmail.com>
---
 drivers/staging/greybus/audio_codec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
index 444c53b4e08d..f752d5fbd685 100644
--- a/drivers/staging/greybus/audio_codec.c
+++ b/drivers/staging/greybus/audio_codec.c
@@ -935,8 +935,6 @@ static void gbaudio_codec_cleanup(struct gbaudio_module_info *module)
 void gbaudio_unregister_module(struct gbaudio_module_info *module)
 {
 	struct snd_soc_component *comp = gbcodec->component;
-	struct gbaudio_jack *jack, *n;
-	int mask;
 
 	dev_dbg(comp->dev, "Unregister %s module\n", module->name);
 
@@ -948,6 +946,8 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module)
 	mutex_unlock(&gbcodec->lock);
 
 #ifdef CONFIG_SND_JACK
+	struct gbaudio_jack *jack, *n;
+	int mask;
 	/* free jack devices for this module jack_list */
 	list_for_each_entry_safe(jack, n, &module->jack_list, list) {
 		if (jack == &module->headset)
-- 
2.34.1


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

* Re: [PATCH] staging: greybus: audio: Limit scope of jack-related variables
  2026-01-20  7:07 [PATCH] staging: greybus: audio: Limit scope of jack-related variables Lee Yongjun
@ 2026-01-20  7:09 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2026-01-20  7:09 UTC (permalink / raw)
  To: Lee Yongjun
  Cc: vaibhav.sr, mgreer, johan, elder, greybus-dev, linux-staging,
	linux-kernel

On Tue, Jan 20, 2026 at 04:07:01PM +0900, Lee Yongjun wrote:
> Move jack-related variable declarations inside the CONFIG_SND_JACK
> conditional block.
> 
> These variables are only used when CONFIG_SND_JACK is enabled, so
> limiting their scope improves code clarity and avoids unused variable
> warnings when the option is disabled.
> 
> No functional changes intended.
> 
> Signed-off-by: Lee Yongjun <jun85566@gmail.com>
> ---
>  drivers/staging/greybus/audio_codec.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c
> index 444c53b4e08d..f752d5fbd685 100644
> --- a/drivers/staging/greybus/audio_codec.c
> +++ b/drivers/staging/greybus/audio_codec.c
> @@ -935,8 +935,6 @@ static void gbaudio_codec_cleanup(struct gbaudio_module_info *module)
>  void gbaudio_unregister_module(struct gbaudio_module_info *module)
>  {
>  	struct snd_soc_component *comp = gbcodec->component;
> -	struct gbaudio_jack *jack, *n;
> -	int mask;
>  
>  	dev_dbg(comp->dev, "Unregister %s module\n", module->name);
>  
> @@ -948,6 +946,8 @@ void gbaudio_unregister_module(struct gbaudio_module_info *module)
>  	mutex_unlock(&gbcodec->lock);
>  
>  #ifdef CONFIG_SND_JACK
> +	struct gbaudio_jack *jack, *n;
> +	int mask;
>  	/* free jack devices for this module jack_list */

Please no, let's keep the variable definitions at the top of the scope
please.  The compiler will handle this just fine if they aren't used due
to the config option not being enabled.

thanks,

greg k-h

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

end of thread, other threads:[~2026-01-20  7:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-20  7:07 [PATCH] staging: greybus: audio: Limit scope of jack-related variables Lee Yongjun
2026-01-20  7:09 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox