mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda - Fix unused warnings when !SND_HDA_NEEDS_RESUME
@ 2011-04-19 21:02 Mike Waychison
  2011-04-20 12:16 ` Takashi Iwai
  2011-04-20 19:04 ` Mike Waychison
  0 siblings, 2 replies; 4+ messages in thread
From: Mike Waychison @ 2011-04-19 21:02 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, Raymond Yau, David Henningsson,
	Mike Waychison, Luke Yelavich, alsa-devel, linux-kernel
  Cc: Mike Waychison

When SND_HDA_NEEDS_RESUME is not defined, the compiler identifies that
the following symbols are static but not used:

  restore_shutup_pins
  hda_cleanup_all_streams
  ad198x_power_eapd
  ad198x_power_eapd_write

Fix warnings by moving the above functions to be SND_HDA_NEEDS_RESUME
guards.

Signed-off-by: Mike Waychison <mikew@google.com>
---
Applies to v2.6.39-rc4.
Compile tested with and without CONFIG_SND_HDA_POWER_SAVE.
---
 sound/pci/hda/hda_codec.c    |   58 +++++++++++++++++++++---------------------
 sound/pci/hda/patch_analog.c |   28 ++++++++++----------
 2 files changed, 43 insertions(+), 43 deletions(-)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 430f41d..fbb046f 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -937,23 +937,6 @@ void snd_hda_shutup_pins(struct hda_codec *codec)
 }
 EXPORT_SYMBOL_HDA(snd_hda_shutup_pins);
 
-/* Restore the pin controls cleared previously via snd_hda_shutup_pins() */
-static void restore_shutup_pins(struct hda_codec *codec)
-{
-	int i;
-	if (!codec->pins_shutup)
-		return;
-	if (codec->bus->shutdown)
-		return;
-	for (i = 0; i < codec->init_pins.used; i++) {
-		struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
-		snd_hda_codec_write(codec, pin->nid, 0,
-				    AC_VERB_SET_PIN_WIDGET_CONTROL,
-				    pin->ctrl);
-	}
-	codec->pins_shutup = 0;
-}
-
 static void init_hda_cache(struct hda_cache_rec *cache,
 			   unsigned int record_size);
 static void free_hda_cache(struct hda_cache_rec *cache);
@@ -1329,18 +1312,6 @@ static void purify_inactive_streams(struct hda_codec *codec)
 	}
 }
 
-/* clean up all streams; called from suspend */
-static void hda_cleanup_all_streams(struct hda_codec *codec)
-{
-	int i;
-
-	for (i = 0; i < codec->cvt_setups.used; i++) {
-		struct hda_cvt_setup *p = snd_array_elem(&codec->cvt_setups, i);
-		if (p->stream_tag)
-			really_cleanup_stream(codec, p);
-	}
-}
-
 /*
  * amp access functions
  */
@@ -3049,6 +3020,18 @@ static inline void hda_exec_init_verbs(struct hda_codec *codec) {}
 #endif
 
 #ifdef SND_HDA_NEEDS_RESUME
+/* clean up all streams; called from suspend */
+static void hda_cleanup_all_streams(struct hda_codec *codec)
+{
+	int i;
+
+	for (i = 0; i < codec->cvt_setups.used; i++) {
+		struct hda_cvt_setup *p = snd_array_elem(&codec->cvt_setups, i);
+		if (p->stream_tag)
+			really_cleanup_stream(codec, p);
+	}
+}
+
 /*
  * call suspend and power-down; used both from PM and power-save
  */
@@ -3069,6 +3052,23 @@ static void hda_call_codec_suspend(struct hda_codec *codec)
 #endif
 }
 
+/* Restore the pin controls cleared previously via snd_hda_shutup_pins() */
+static void restore_shutup_pins(struct hda_codec *codec)
+{
+	int i;
+	if (!codec->pins_shutup)
+		return;
+	if (codec->bus->shutdown)
+		return;
+	for (i = 0; i < codec->init_pins.used; i++) {
+		struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
+		snd_hda_codec_write(codec, pin->nid, 0,
+				    AC_VERB_SET_PIN_WIDGET_CONTROL,
+				    pin->ctrl);
+	}
+	codec->pins_shutup = 0;
+}
+
 /*
  * kick up codec; used both from PM and power-save
  */
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 2942d2a..bcabcee 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -507,6 +507,20 @@ static void ad198x_free_kctls(struct hda_codec *codec)
 	snd_array_free(&spec->kctls);
 }
 
+static void ad198x_free(struct hda_codec *codec)
+{
+	struct ad198x_spec *spec = codec->spec;
+
+	if (!spec)
+		return;
+
+	ad198x_shutup(codec);
+	ad198x_free_kctls(codec);
+	kfree(spec);
+	snd_hda_detach_beep_device(codec);
+}
+
+#ifdef SND_HDA_NEEDS_RESUME
 static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front,
 				hda_nid_t hp)
 {
@@ -547,20 +561,6 @@ static void ad198x_power_eapd(struct hda_codec *codec)
 	}
 }
 
-static void ad198x_free(struct hda_codec *codec)
-{
-	struct ad198x_spec *spec = codec->spec;
-
-	if (!spec)
-		return;
-
-	ad198x_shutup(codec);
-	ad198x_free_kctls(codec);
-	kfree(spec);
-	snd_hda_detach_beep_device(codec);
-}
-
-#ifdef SND_HDA_NEEDS_RESUME
 static int ad198x_suspend(struct hda_codec *codec, pm_message_t state)
 {
 	ad198x_shutup(codec);
-- 
1.7.3.1


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

* Re: [PATCH] ALSA: hda - Fix unused warnings when !SND_HDA_NEEDS_RESUME
  2011-04-19 21:02 [PATCH] ALSA: hda - Fix unused warnings when !SND_HDA_NEEDS_RESUME Mike Waychison
@ 2011-04-20 12:16 ` Takashi Iwai
  2011-04-20 19:04 ` Mike Waychison
  1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2011-04-20 12:16 UTC (permalink / raw)
  To: Mike Waychison
  Cc: Jaroslav Kysela, Raymond Yau, David Henningsson, Luke Yelavich,
	alsa-devel, linux-kernel

At Tue, 19 Apr 2011 14:02:17 -0700,
Mike Waychison wrote:
> 
> When SND_HDA_NEEDS_RESUME is not defined, the compiler identifies that
> the following symbols are static but not used:
> 
>   restore_shutup_pins
>   hda_cleanup_all_streams

I prefer adding ifdef around the functions for these, since they are
related with the functions around them.  Otherwise the corelation will
be lost.

>   ad198x_power_eapd
>   ad198x_power_eapd_write

They can be better moved, indeed.
OTOH, I'm going to apply ad198x_power_eapd() also for the normal
shutdown case, so they will be not only with SND_HDA_NEEDS_RESUME.
Please leave them as they are for now.

Could you resubmit the patch?


thanks,

Takashi

> 
> Fix warnings by moving the above functions to be SND_HDA_NEEDS_RESUME
> guards.
> 
> Signed-off-by: Mike Waychison <mikew@google.com>
> ---
> Applies to v2.6.39-rc4.
> Compile tested with and without CONFIG_SND_HDA_POWER_SAVE.
> ---
>  sound/pci/hda/hda_codec.c    |   58 +++++++++++++++++++++---------------------
>  sound/pci/hda/patch_analog.c |   28 ++++++++++----------
>  2 files changed, 43 insertions(+), 43 deletions(-)
> 
> diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
> index 430f41d..fbb046f 100644
> --- a/sound/pci/hda/hda_codec.c
> +++ b/sound/pci/hda/hda_codec.c
> @@ -937,23 +937,6 @@ void snd_hda_shutup_pins(struct hda_codec *codec)
>  }
>  EXPORT_SYMBOL_HDA(snd_hda_shutup_pins);
>  
> -/* Restore the pin controls cleared previously via snd_hda_shutup_pins() */
> -static void restore_shutup_pins(struct hda_codec *codec)
> -{
> -	int i;
> -	if (!codec->pins_shutup)
> -		return;
> -	if (codec->bus->shutdown)
> -		return;
> -	for (i = 0; i < codec->init_pins.used; i++) {
> -		struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
> -		snd_hda_codec_write(codec, pin->nid, 0,
> -				    AC_VERB_SET_PIN_WIDGET_CONTROL,
> -				    pin->ctrl);
> -	}
> -	codec->pins_shutup = 0;
> -}
> -
>  static void init_hda_cache(struct hda_cache_rec *cache,
>  			   unsigned int record_size);
>  static void free_hda_cache(struct hda_cache_rec *cache);
> @@ -1329,18 +1312,6 @@ static void purify_inactive_streams(struct hda_codec *codec)
>  	}
>  }
>  
> -/* clean up all streams; called from suspend */
> -static void hda_cleanup_all_streams(struct hda_codec *codec)
> -{
> -	int i;
> -
> -	for (i = 0; i < codec->cvt_setups.used; i++) {
> -		struct hda_cvt_setup *p = snd_array_elem(&codec->cvt_setups, i);
> -		if (p->stream_tag)
> -			really_cleanup_stream(codec, p);
> -	}
> -}
> -
>  /*
>   * amp access functions
>   */
> @@ -3049,6 +3020,18 @@ static inline void hda_exec_init_verbs(struct hda_codec *codec) {}
>  #endif
>  
>  #ifdef SND_HDA_NEEDS_RESUME
> +/* clean up all streams; called from suspend */
> +static void hda_cleanup_all_streams(struct hda_codec *codec)
> +{
> +	int i;
> +
> +	for (i = 0; i < codec->cvt_setups.used; i++) {
> +		struct hda_cvt_setup *p = snd_array_elem(&codec->cvt_setups, i);
> +		if (p->stream_tag)
> +			really_cleanup_stream(codec, p);
> +	}
> +}
> +
>  /*
>   * call suspend and power-down; used both from PM and power-save
>   */
> @@ -3069,6 +3052,23 @@ static void hda_call_codec_suspend(struct hda_codec *codec)
>  #endif
>  }
>  
> +/* Restore the pin controls cleared previously via snd_hda_shutup_pins() */
> +static void restore_shutup_pins(struct hda_codec *codec)
> +{
> +	int i;
> +	if (!codec->pins_shutup)
> +		return;
> +	if (codec->bus->shutdown)
> +		return;
> +	for (i = 0; i < codec->init_pins.used; i++) {
> +		struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
> +		snd_hda_codec_write(codec, pin->nid, 0,
> +				    AC_VERB_SET_PIN_WIDGET_CONTROL,
> +				    pin->ctrl);
> +	}
> +	codec->pins_shutup = 0;
> +}
> +
>  /*
>   * kick up codec; used both from PM and power-save
>   */
> diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
> index 2942d2a..bcabcee 100644
> --- a/sound/pci/hda/patch_analog.c
> +++ b/sound/pci/hda/patch_analog.c
> @@ -507,6 +507,20 @@ static void ad198x_free_kctls(struct hda_codec *codec)
>  	snd_array_free(&spec->kctls);
>  }
>  
> +static void ad198x_free(struct hda_codec *codec)
> +{
> +	struct ad198x_spec *spec = codec->spec;
> +
> +	if (!spec)
> +		return;
> +
> +	ad198x_shutup(codec);
> +	ad198x_free_kctls(codec);
> +	kfree(spec);
> +	snd_hda_detach_beep_device(codec);
> +}
> +
> +#ifdef SND_HDA_NEEDS_RESUME
>  static void ad198x_power_eapd_write(struct hda_codec *codec, hda_nid_t front,
>  				hda_nid_t hp)
>  {
> @@ -547,20 +561,6 @@ static void ad198x_power_eapd(struct hda_codec *codec)
>  	}
>  }
>  
> -static void ad198x_free(struct hda_codec *codec)
> -{
> -	struct ad198x_spec *spec = codec->spec;
> -
> -	if (!spec)
> -		return;
> -
> -	ad198x_shutup(codec);
> -	ad198x_free_kctls(codec);
> -	kfree(spec);
> -	snd_hda_detach_beep_device(codec);
> -}
> -
> -#ifdef SND_HDA_NEEDS_RESUME
>  static int ad198x_suspend(struct hda_codec *codec, pm_message_t state)
>  {
>  	ad198x_shutup(codec);
> -- 
> 1.7.3.1
> 

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

* [PATCH] ALSA: hda - Fix unused warnings when !SND_HDA_NEEDS_RESUME
  2011-04-19 21:02 [PATCH] ALSA: hda - Fix unused warnings when !SND_HDA_NEEDS_RESUME Mike Waychison
  2011-04-20 12:16 ` Takashi Iwai
@ 2011-04-20 19:04 ` Mike Waychison
  2011-04-20 19:25   ` Takashi Iwai
  1 sibling, 1 reply; 4+ messages in thread
From: Mike Waychison @ 2011-04-20 19:04 UTC (permalink / raw)
  To: Jaroslav Kysela, Takashi Iwai, alsa-devel, linux-kernel,
	Raymond Yau, David Henningsson, Luke Yelavich
  Cc: Mike Waychison

When SND_HDA_NEEDS_RESUME is not defined, the compiler identifies that
the following symbols are static but not used:

 restore_shutup_pins
 hda_cleanup_all_streams

Fix warnings by adding SND_HDA_NEEDS_RESUME guards.

Signed-off-by: Mike Waychison <mikew@google.com>
---
v2:
- Applies to v2.6.39-rc4.
- Dropped moving ad198x_power_eapd and ad198x_power_eapd_write at
  Takashi Iwai <tiwai@suse.de>'s request.
---
 sound/pci/hda/hda_codec.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 430f41d..759ade1 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -937,6 +937,7 @@ void snd_hda_shutup_pins(struct hda_codec *codec)
 }
 EXPORT_SYMBOL_HDA(snd_hda_shutup_pins);
 
+#ifdef SND_HDA_NEEDS_RESUME
 /* Restore the pin controls cleared previously via snd_hda_shutup_pins() */
 static void restore_shutup_pins(struct hda_codec *codec)
 {
@@ -953,6 +954,7 @@ static void restore_shutup_pins(struct hda_codec *codec)
 	}
 	codec->pins_shutup = 0;
 }
+#endif
 
 static void init_hda_cache(struct hda_cache_rec *cache,
 			   unsigned int record_size);
@@ -1329,6 +1331,7 @@ static void purify_inactive_streams(struct hda_codec *codec)
 	}
 }
 
+#ifdef SND_HDA_NEEDS_RESUME
 /* clean up all streams; called from suspend */
 static void hda_cleanup_all_streams(struct hda_codec *codec)
 {
@@ -1340,6 +1343,7 @@ static void hda_cleanup_all_streams(struct hda_codec *codec)
 			really_cleanup_stream(codec, p);
 	}
 }
+#endif
 
 /*
  * amp access functions
-- 
1.7.3.1


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

* Re: [PATCH] ALSA: hda - Fix unused warnings when !SND_HDA_NEEDS_RESUME
  2011-04-20 19:04 ` Mike Waychison
@ 2011-04-20 19:25   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2011-04-20 19:25 UTC (permalink / raw)
  To: Mike Waychison
  Cc: Jaroslav Kysela, alsa-devel, linux-kernel, Raymond Yau,
	David Henningsson, Luke Yelavich

At Wed, 20 Apr 2011 12:04:36 -0700,
Mike Waychison wrote:
> 
> When SND_HDA_NEEDS_RESUME is not defined, the compiler identifies that
> the following symbols are static but not used:
> 
>  restore_shutup_pins
>  hda_cleanup_all_streams
> 
> Fix warnings by adding SND_HDA_NEEDS_RESUME guards.
> 
> Signed-off-by: Mike Waychison <mikew@google.com>

Applied now.  Thanks!


Takashi

> ---
> v2:
> - Applies to v2.6.39-rc4.
> - Dropped moving ad198x_power_eapd and ad198x_power_eapd_write at
>   Takashi Iwai <tiwai@suse.de>'s request.
> ---
>  sound/pci/hda/hda_codec.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
> index 430f41d..759ade1 100644
> --- a/sound/pci/hda/hda_codec.c
> +++ b/sound/pci/hda/hda_codec.c
> @@ -937,6 +937,7 @@ void snd_hda_shutup_pins(struct hda_codec *codec)
>  }
>  EXPORT_SYMBOL_HDA(snd_hda_shutup_pins);
>  
> +#ifdef SND_HDA_NEEDS_RESUME
>  /* Restore the pin controls cleared previously via snd_hda_shutup_pins() */
>  static void restore_shutup_pins(struct hda_codec *codec)
>  {
> @@ -953,6 +954,7 @@ static void restore_shutup_pins(struct hda_codec *codec)
>  	}
>  	codec->pins_shutup = 0;
>  }
> +#endif
>  
>  static void init_hda_cache(struct hda_cache_rec *cache,
>  			   unsigned int record_size);
> @@ -1329,6 +1331,7 @@ static void purify_inactive_streams(struct hda_codec *codec)
>  	}
>  }
>  
> +#ifdef SND_HDA_NEEDS_RESUME
>  /* clean up all streams; called from suspend */
>  static void hda_cleanup_all_streams(struct hda_codec *codec)
>  {
> @@ -1340,6 +1343,7 @@ static void hda_cleanup_all_streams(struct hda_codec *codec)
>  			really_cleanup_stream(codec, p);
>  	}
>  }
> +#endif
>  
>  /*
>   * amp access functions
> -- 
> 1.7.3.1
> 

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

end of thread, other threads:[~2011-04-20 19:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-19 21:02 [PATCH] ALSA: hda - Fix unused warnings when !SND_HDA_NEEDS_RESUME Mike Waychison
2011-04-20 12:16 ` Takashi Iwai
2011-04-20 19:04 ` Mike Waychison
2011-04-20 19:25   ` Takashi Iwai

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

all inboxes | Powered by JetHome®