public inbox for linux-next@vger.kernel.org 
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse•de>
To: Stratos Karafotis <stratosk@semaphore•gr>
Cc: Jaroslav Kysela <perex@perex•cz>,
	David Henningsson <david.henningsson@canonical•com>,
	alsa-devel@alsa-project•org, linux-kernel@vger•kernel.org,
	linux-next@vger•kernel.org
Subject: Re: [PATCH next-20130124] Sound: pci: Fix unused variable warning in patch_sigmatel.c
Date: Fri, 25 Jan 2013 10:09:56 +0100	[thread overview]
Message-ID: <s5hehh9d3x7.wl%tiwai@suse.de> (raw)
In-Reply-To: <5101B7CE.4070102@semaphore.gr>

At Fri, 25 Jan 2013 00:38:06 +0200,
Stratos Karafotis wrote:
> 
> Fix the following build warnings
> 
> sound/pci/hda/patch_sigmatel.c: In function ‘stac92hd71bxx_fixup_hp’:
> sound/pci/hda/patch_sigmatel.c:2434:24: warning: unused variable ‘spec’ [-Wunused-variable]

Thanks for catching.  But such temporal cast like your patch makes the
code readability much worse.  The code readability (thus its
maintainability) is a more important factor.

I'm going to fix the definition of snd_printd() itself for fixing this
kind of warnings.  We can use inline functions instead of empty macros
to achieve the same but without triggering compiler warnings.


Takashi

> 
> Signed-off-by: Stratos Karafotis <stratosk@semaphore•gr>
> ---
>  sound/pci/hda/patch_sigmatel.c | 14 +++++---------
>  1 file changed, 5 insertions(+), 9 deletions(-)
> 
> diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
> index 0aa0ceb..f269d1f 100644
> --- a/sound/pci/hda/patch_sigmatel.c
> +++ b/sound/pci/hda/patch_sigmatel.c
> @@ -2365,7 +2365,6 @@ static void stac92hd71bxx_fixup_ref(struct hda_codec *codec,
>  static void stac92hd71bxx_fixup_hp_m4(struct hda_codec *codec,
>  				      const struct hda_fixup *fix, int action)
>  {
> -	struct sigmatel_spec *spec = codec->spec;
>  	struct hda_jack_tbl *jack;
>  
>  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
> @@ -2381,7 +2380,7 @@ static void stac92hd71bxx_fixup_hp_m4(struct hda_codec *codec,
>  	if (jack)
>  		jack->private_data = 0x02;
>  
> -	spec->gpio_mask |= 0x02;
> +	((struct sigmatel_spec *)codec->spec)->gpio_mask |= 0x02;
>  
>  	/* enable internal microphone */
>  	snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040);
> @@ -2420,19 +2419,15 @@ static void stac92hd71bxx_fixup_hp_dv5(struct hda_codec *codec,
>  static void stac92hd71bxx_fixup_hp_hdx(struct hda_codec *codec,
>  				       const struct hda_fixup *fix, int action)
>  {
> -	struct sigmatel_spec *spec = codec->spec;
> -
>  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
>  		return;
> -	spec->gpio_led = 0x08;
> +	((struct sigmatel_spec *)codec->spec)->gpio_led = 0x08;
>  }
>  
>  
>  static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,
>  				   const struct hda_fixup *fix, int action)
>  {
> -	struct sigmatel_spec *spec = codec->spec;
> -
>  	if (action != HDA_FIXUP_ACT_PRE_PROBE)
>  		return;
>  
> @@ -2456,8 +2451,9 @@ static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,
>  
>  	if (find_mute_led_cfg(codec, 1))
>  		snd_printd("mute LED gpio %d polarity %d\n",
> -				spec->gpio_led,
> -				spec->gpio_led_polarity);
> +			((struct sigmatel_spec *)codec->spec)->gpio_led,
> +			((struct sigmatel_spec *)codec->spec)->
> +							gpio_led_polarity);
>  
>  }
>  
> -- 
> 1.8.1
> 

  reply	other threads:[~2013-01-25  9:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-24 22:38 [PATCH next-20130124] Sound: pci: Fix unused variable warning in patch_sigmatel.c Stratos Karafotis
2013-01-25  9:09 ` Takashi Iwai [this message]
2013-01-25 10:03   ` Joe Perches
2013-01-25 10:17     ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hehh9d3x7.wl%tiwai@suse.de \
    --to=tiwai@suse$(echo .)de \
    --cc=alsa-devel@alsa-project$(echo .)org \
    --cc=david.henningsson@canonical$(echo .)com \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=linux-next@vger$(echo .)kernel.org \
    --cc=perex@perex$(echo .)cz \
    --cc=stratosk@semaphore$(echo .)gr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox