public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC: 2.6 patch] sound/pci/hda/patch_realtek.c: remove dead code
@ 2007-06-15 21:45 Adrian Bunk
  2007-06-19 10:20 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2007-06-15 21:45 UTC (permalink / raw)
  To: Kailang Yang; +Cc: Takashi Iwai, Jaroslav Kysela, linux-kernel

This patch removes dead code spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 sound/pci/hda/patch_realtek.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

--- linux-2.6.22-rc4-mm2/sound/pci/hda/patch_realtek.c.old	2007-06-15 21:48:12.000000000 +0200
+++ linux-2.6.22-rc4-mm2/sound/pci/hda/patch_realtek.c	2007-06-15 23:12:40.000000000 +0200
@@ -10704,30 +10704,31 @@ static struct hda_verb alc662_init_verbs
 	/* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
 	/* Input mixer */
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
 	{ }
 };
 
 static struct hda_verb alc662_sue_init_verbs[] = {
 	{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
 	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
         {}
 };
 
+#if 0
 /*
  * generic initialization of ADC, input mixers and output mixers
  */
 static struct hda_verb alc662_auto_init_verbs[] = {
 	/*
 	 * Unmute ADC and set the default input to mic-in
 	 */
 	{0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
 	{0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 
 	/* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
 	 * mixer widget
 	 * Note: PASD motherboards uses the Line In 2 as the input for front
 	 * panel mic (mic 2)
 	 */
@@ -10755,30 +10756,31 @@ static struct hda_verb alc662_auto_init_
 	{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 	{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
 
 
 	/* FIXME: use matrix-type input source selection */
 	/* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
 	/* Input mixer */
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
 	/*{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},*/
 	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
 
 	{ }
 };
+#endif  /*  0  */
 
 /* capture mixer elements */
 static struct snd_kcontrol_new alc662_capture_mixer[] = {
 	HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
 	HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
 	{
 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
 		/* The multiple "Capture Source" controls confuse alsamixer
 		 * So call somewhat different..
 		 * FIXME: the controls appear in the "playback" view!
 		 */
 		/* .name = "Capture Source", */
 		.name = "Input Source",
 		.count = 1,
 		.info = alc882_mux_enum_info,
@@ -11152,35 +11154,30 @@ static int alc662_parse_auto_config(stru
 	err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
 	if (err < 0)
 		return err;
 
 	spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
 	if (spec->autocfg.dig_out_pin)
 		spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
 
 	if (spec->kctl_alloc)
 		spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
 
 	spec->num_mux_defs = 1;
 	spec->input_mux = &spec->private_imux;
 	
-	if (err < 0)
-		return err;
-	else if (err > 0)
-		/* hack - override the init verbs */
-		spec->init_verbs[0] = alc662_auto_init_verbs;
 	spec->mixers[spec->num_mixers] = alc662_capture_mixer;
 	spec->num_mixers++;
 	return err;
 }
 
 /* additional initialization for auto-configuration model */
 static void alc662_auto_init(struct hda_codec *codec)
 {
 	alc662_auto_init_multi_out(codec);
 	alc662_auto_init_hp_out(codec);
 	alc662_auto_init_analog_input(codec);
 }
 
 static int patch_alc662(struct hda_codec *codec)
 {


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

* Re: [RFC: 2.6 patch] sound/pci/hda/patch_realtek.c: remove dead code
  2007-06-15 21:45 [RFC: 2.6 patch] sound/pci/hda/patch_realtek.c: remove dead code Adrian Bunk
@ 2007-06-19 10:20 ` Takashi Iwai
  2007-07-01 20:21   ` [2.6 " Adrian Bunk
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2007-06-19 10:20 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Kailang Yang, Jaroslav Kysela, linux-kernel

At Fri, 15 Jun 2007 23:45:31 +0200,
Adrian Bunk wrote:
> 
> This patch removes dead code spotted by the Coverity checker.
> 
> Signed-off-by: Adrian Bunk <bunk@stusta.de>

This appears to be a copy-and-paste error from other
auto-configuration code.  I fixed it on ALSA tree now so that it'll be
merged to the next mm...


thanks,

Takashi

> 
> ---
> 
>  sound/pci/hda/patch_realtek.c |    7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> --- linux-2.6.22-rc4-mm2/sound/pci/hda/patch_realtek.c.old	2007-06-15 21:48:12.000000000 +0200
> +++ linux-2.6.22-rc4-mm2/sound/pci/hda/patch_realtek.c	2007-06-15 23:12:40.000000000 +0200
> @@ -10704,30 +10704,31 @@ static struct hda_verb alc662_init_verbs
>  	/* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
>  	/* Input mixer */
>  	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
>  	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
>  	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
>  	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
>  	{ }
>  };
>  
>  static struct hda_verb alc662_sue_init_verbs[] = {
>  	{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},
>  	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT},
>          {}
>  };
>  
> +#if 0
>  /*
>   * generic initialization of ADC, input mixers and output mixers
>   */
>  static struct hda_verb alc662_auto_init_verbs[] = {
>  	/*
>  	 * Unmute ADC and set the default input to mic-in
>  	 */
>  	{0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
>  	{0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
>  
>  	/* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
>  	 * mixer widget
>  	 * Note: PASD motherboards uses the Line In 2 as the input for front
>  	 * panel mic (mic 2)
>  	 */
> @@ -10755,30 +10756,31 @@ static struct hda_verb alc662_auto_init_
>  	{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
>  	{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
>  
>  
>  	/* FIXME: use matrix-type input source selection */
>  	/* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
>  	/* Input mixer */
>  	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
>  	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
>  	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
>  	/*{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},*/
>  	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},
>  
>  	{ }
>  };
> +#endif  /*  0  */
>  
>  /* capture mixer elements */
>  static struct snd_kcontrol_new alc662_capture_mixer[] = {
>  	HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
>  	HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
>  	{
>  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
>  		/* The multiple "Capture Source" controls confuse alsamixer
>  		 * So call somewhat different..
>  		 * FIXME: the controls appear in the "playback" view!
>  		 */
>  		/* .name = "Capture Source", */
>  		.name = "Input Source",
>  		.count = 1,
>  		.info = alc882_mux_enum_info,
> @@ -11152,35 +11154,30 @@ static int alc662_parse_auto_config(stru
>  	err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
>  	if (err < 0)
>  		return err;
>  
>  	spec->multiout.max_channels = spec->multiout.num_dacs * 2;
>  
>  	if (spec->autocfg.dig_out_pin)
>  		spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
>  
>  	if (spec->kctl_alloc)
>  		spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
>  
>  	spec->num_mux_defs = 1;
>  	spec->input_mux = &spec->private_imux;
>  	
> -	if (err < 0)
> -		return err;
> -	else if (err > 0)
> -		/* hack - override the init verbs */
> -		spec->init_verbs[0] = alc662_auto_init_verbs;
>  	spec->mixers[spec->num_mixers] = alc662_capture_mixer;
>  	spec->num_mixers++;
>  	return err;
>  }
>  
>  /* additional initialization for auto-configuration model */
>  static void alc662_auto_init(struct hda_codec *codec)
>  {
>  	alc662_auto_init_multi_out(codec);
>  	alc662_auto_init_hp_out(codec);
>  	alc662_auto_init_analog_input(codec);
>  }
>  
>  static int patch_alc662(struct hda_codec *codec)
>  {
> 

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

* [2.6 patch] sound/pci/hda/patch_realtek.c: remove dead code
  2007-06-19 10:20 ` Takashi Iwai
@ 2007-07-01 20:21   ` Adrian Bunk
  2007-07-02 14:26     ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Adrian Bunk @ 2007-07-01 20:21 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Kailang Yang, Jaroslav Kysela, linux-kernel

On Tue, Jun 19, 2007 at 12:20:36PM +0200, Takashi Iwai wrote:
> At Fri, 15 Jun 2007 23:45:31 +0200,
> Adrian Bunk wrote:
> > 
> > This patch removes dead code spotted by the Coverity checker.
> > 
> > Signed-off-by: Adrian Bunk <bunk@stusta.de>
> 
> This appears to be a copy-and-paste error from other
> auto-configuration code.  I fixed it on ALSA tree now so that it'll be
> merged to the next mm...

Thanks.

The patch below removes the remaining and really dead code.

> thanks,
> 
> Takashi

cu
Adrian


<--  snip  -->


This patch removes some dead code spotted by the Coverity checker.

Signed-off-by: Adrian Bunk <bunk@stusta.de>

---

 sound/pci/hda/patch_realtek.c |    2 --
 1 file changed, 2 deletions(-)

--- linux-2.6.22-rc6-mm1/sound/pci/hda/patch_realtek.c.old	2007-06-29 22:47:35.000000000 +0200
+++ linux-2.6.22-rc6-mm1/sound/pci/hda/patch_realtek.c	2007-06-29 23:45:48.000000000 +0200
@@ -11170,32 +11170,30 @@ static int alc662_parse_auto_config(stru
 	err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg);
 	if (err < 0)
 		return err;
 
 	spec->multiout.max_channels = spec->multiout.num_dacs * 2;
 
 	if (spec->autocfg.dig_out_pin)
 		spec->multiout.dig_out_nid = ALC880_DIGOUT_NID;
 
 	if (spec->kctl_alloc)
 		spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
 
 	spec->num_mux_defs = 1;
 	spec->input_mux = &spec->private_imux;
 	
-	if (err < 0)
-		return err;
 	spec->init_verbs[spec->num_init_verbs++] = alc662_auto_init_verbs;
 	spec->mixers[spec->num_mixers] = alc662_capture_mixer;
 	spec->num_mixers++;
 	return 1;
 }
 
 /* additional initialization for auto-configuration model */
 static void alc662_auto_init(struct hda_codec *codec)
 {
 	alc662_auto_init_multi_out(codec);
 	alc662_auto_init_hp_out(codec);
 	alc662_auto_init_analog_input(codec);
 }
 
 static int patch_alc662(struct hda_codec *codec)


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

* Re: [2.6 patch] sound/pci/hda/patch_realtek.c: remove dead code
  2007-07-01 20:21   ` [2.6 " Adrian Bunk
@ 2007-07-02 14:26     ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2007-07-02 14:26 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: Kailang Yang, Jaroslav Kysela, linux-kernel

At Sun, 1 Jul 2007 22:21:18 +0200,
Adrian Bunk wrote:
> 
> On Tue, Jun 19, 2007 at 12:20:36PM +0200, Takashi Iwai wrote:
> > At Fri, 15 Jun 2007 23:45:31 +0200,
> > Adrian Bunk wrote:
> > > 
> > > This patch removes dead code spotted by the Coverity checker.
> > > 
> > > Signed-off-by: Adrian Bunk <bunk@stusta.de>
> > 
> > This appears to be a copy-and-paste error from other
> > auto-configuration code.  I fixed it on ALSA tree now so that it'll be
> > merged to the next mm...
> 
> Thanks.
> 
> The patch below removes the remaining and really dead code.

Oh, yeah, thanks.  Merged to ALSA tree now.


Takashi

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

end of thread, other threads:[~2007-07-02 14:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-15 21:45 [RFC: 2.6 patch] sound/pci/hda/patch_realtek.c: remove dead code Adrian Bunk
2007-06-19 10:20 ` Takashi Iwai
2007-07-01 20:21   ` [2.6 " Adrian Bunk
2007-07-02 14:26     ` Takashi Iwai

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