mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch] snd: fix build bug with CONFIG_SND_HDA_CODEC_SIGMATEL=y && !CONFIG_SND_HDA_GENERIC
@ 2007-10-18  9:50 Ingo Molnar
  2007-10-18 13:37 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2007-10-18  9:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: Takashi Iwai, Jaroslav Kysela, Andrew Morton


fix build bug introduced with the recent sound merge:

-------------->
Subject: snd: fix build bug with CONFIG_SND_HDA_CODEC_SIGMATEL=y && !CONFIG_SND_HDA_GENERIC
From: Ingo Molnar <mingo@elte.hu>

randconfig build testing found this build bug:

 sound/built-in.o: In function `patch_stac9872':
 patch_sigmatel.c:(.text+0x6d6e7): undefined reference to `snd_hda_parse_generic_codec'

patch_sigmatel.c depends on SND_HDA_GENERIC, for snd_hda_parse_generic_codec().

to make it selectable, reorder SND_HDA_CODEC_SIGMATEL to after
SND_HDA_GENERIC.

with this fixed, the kernel builds fine.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 sound/pci/Kconfig |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Index: linux/sound/pci/Kconfig
===================================================================
--- linux.orig/sound/pci/Kconfig
+++ linux/sound/pci/Kconfig
@@ -525,14 +525,6 @@ config SND_HDA_CODEC_ANALOG
 	  Say Y here to include Analog Device HD-audio codec support in
 	  snd-hda-intel driver, such as AD1986A.
 
-config SND_HDA_CODEC_SIGMATEL
-	bool "Build IDT/Sigmatel HD-audio codec support"
-	depends on SND_HDA_INTEL
-	default y
-	help
-	  Say Y here to include IDT (Sigmatel) HD-audio codec support in
-	  snd-hda-intel driver, such as STAC9200.
-
 config SND_HDA_CODEC_VIA
 	bool "Build VIA HD-audio codec support"
 	depends on SND_HDA_INTEL
@@ -581,6 +573,15 @@ config SND_HDA_GENERIC
 	  Say Y here to enable the generic HD-audio codec parser
 	  in snd-hda-intel driver.
 
+config SND_HDA_CODEC_SIGMATEL
+	bool "Build IDT/Sigmatel HD-audio codec support"
+	depends on SND_HDA_INTEL
+	select SND_HDA_GENERIC
+	default y
+	help
+	  Say Y here to include IDT (Sigmatel) HD-audio codec support in
+	  snd-hda-intel driver, such as STAC9200.
+
 config SND_HDA_POWER_SAVE
 	bool "Aggressive power-saving on HD-audio"
 	depends on SND_HDA_INTEL && EXPERIMENTAL

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

* Re: [patch] snd: fix build bug with CONFIG_SND_HDA_CODEC_SIGMATEL=y && !CONFIG_SND_HDA_GENERIC
  2007-10-18  9:50 [patch] snd: fix build bug with CONFIG_SND_HDA_CODEC_SIGMATEL=y && !CONFIG_SND_HDA_GENERIC Ingo Molnar
@ 2007-10-18 13:37 ` Takashi Iwai
  2007-10-18 14:54   ` Ingo Molnar
  0 siblings, 1 reply; 4+ messages in thread
From: Takashi Iwai @ 2007-10-18 13:37 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Jaroslav Kysela, Andrew Morton

At Thu, 18 Oct 2007 11:50:42 +0200,
Ingo Molnar wrote:
> 
> 
> fix build bug introduced with the recent sound merge:
> 
> -------------->
> Subject: snd: fix build bug with CONFIG_SND_HDA_CODEC_SIGMATEL=y && !CONFIG_SND_HDA_GENERIC
> From: Ingo Molnar <mingo@elte.hu>
> 
> randconfig build testing found this build bug:
> 
>  sound/built-in.o: In function `patch_stac9872':
>  patch_sigmatel.c:(.text+0x6d6e7): undefined reference to `snd_hda_parse_generic_codec'
> 
> patch_sigmatel.c depends on SND_HDA_GENERIC, for snd_hda_parse_generic_codec().
> 
> to make it selectable, reorder SND_HDA_CODEC_SIGMATEL to after
> SND_HDA_GENERIC.
> 
> with this fixed, the kernel builds fine.
> 
> Signed-off-by: Ingo Molnar <mingo@elte.hu>

Thanks for the patch.
But, I'd like to avoid the reverse selection in that config as much as
possible, which will give messy dependencies.  Is the patch below OK?


Takashi

diff -r fb9512ce24e0 sound/pci/hda/patch_sigmatel.c
--- a/sound/pci/hda/patch_sigmatel.c	Thu Oct 18 10:48:43 2007 +0200
+++ b/sound/pci/hda/patch_sigmatel.c	Thu Oct 18 16:23:22 2007 +0200
@@ -3062,9 +3062,16 @@ static int patch_stac9872(struct hda_cod
 	board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
 						  stac9872_models,
 						  stac9872_cfg_tbl);
-	if (board_config < 0)
+	if (board_config < 0) {
+		printk(KERN_WARNING "hda-codec: "
+		       "found unknown STAC9872 device\n");
+#ifdef CONFIG_SND_HDA_GENERIC
 		/* unknown config, let generic-parser do its job... */
 		return snd_hda_parse_generic_codec(codec);
+#else
+		return -ENODEV;
+#endif
+	}
 	
 	spec  = kzalloc(sizeof(*spec), GFP_KERNEL);
 	if (spec == NULL)

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

* Re: [patch] snd: fix build bug with CONFIG_SND_HDA_CODEC_SIGMATEL=y && !CONFIG_SND_HDA_GENERIC
  2007-10-18 14:54   ` Ingo Molnar
@ 2007-10-18 14:18     ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2007-10-18 14:18 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel, Jaroslav Kysela, Andrew Morton

At Thu, 18 Oct 2007 16:54:58 +0200,
Ingo Molnar wrote:
> 
> 
> * Takashi Iwai <tiwai@suse.de> wrote:
> 
> > +++ b/sound/pci/hda/patch_sigmatel.c	Thu Oct 18 16:23:22 2007 +0200
> > @@ -3062,9 +3062,16 @@ static int patch_stac9872(struct hda_cod
> >  	board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
> >  						  stac9872_models,
> >  						  stac9872_cfg_tbl);
> > -	if (board_config < 0)
> > +	if (board_config < 0) {
> > +		printk(KERN_WARNING "hda-codec: "
> > +		       "found unknown STAC9872 device\n");
> > +#ifdef CONFIG_SND_HDA_GENERIC
> >  		/* unknown config, let generic-parser do its job... */
> >  		return snd_hda_parse_generic_codec(codec);
> > +#else
> > +		return -ENODEV;
> > +#endif
> 
> pushing an #ifdef into a driver is quite unclean, if then you should 
> define snd_hda_parse_generic_codec() in a header as a -ENODEV inline 
> function if !CONFIG_SND_HDA_GENERIC.

Fair enough.  The revised patch is below.  This cleans up the ifdefs
in another place, too.


Takashi

diff -r fb9512ce24e0 pci/hda/hda_codec.c
--- a/pci/hda/hda_codec.c	Thu Oct 18 10:48:43 2007 +0200
+++ b/pci/hda/hda_codec.c	Thu Oct 18 17:06:44 2007 +0200
@@ -626,24 +626,19 @@ int __devinit snd_hda_codec_new(struct h
 		snd_hda_get_codec_name(codec, bus->card->mixername,
 				       sizeof(bus->card->mixername));
 
-#ifdef CONFIG_SND_HDA_GENERIC
 	if (is_generic_config(codec)) {
 		err = snd_hda_parse_generic_codec(codec);
 		goto patched;
 	}
-#endif
 	if (codec->preset && codec->preset->patch) {
 		err = codec->preset->patch(codec);
 		goto patched;
 	}
 
 	/* call the default parser */
-#ifdef CONFIG_SND_HDA_GENERIC
 	err = snd_hda_parse_generic_codec(codec);
-#else
-	printk(KERN_ERR "hda-codec: No codec parser is available\n");
-	err = -ENODEV;
-#endif
+	if (err < 0)
+		printk(KERN_ERR "hda-codec: No codec parser is available\n");
 
  patched:
 	if (err < 0) {
diff -r fb9512ce24e0 pci/hda/hda_local.h
--- a/pci/hda/hda_local.h	Thu Oct 18 10:48:43 2007 +0200
+++ b/pci/hda/hda_local.h	Thu Oct 18 17:06:44 2007 +0200
@@ -245,7 +245,14 @@ int snd_hda_multi_out_analog_cleanup(str
 /*
  * generic codec parser
  */
+#ifdef CONFIG_SND_HDA_GENERIC
 int snd_hda_parse_generic_codec(struct hda_codec *codec);
+#else
+static int snd_hda_parse_generic_codec(struct hda_codec *codec)
+{
+	return -ENODEV;
+}
+#endif
 
 /*
  * generic proc interface

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

* Re: [patch] snd: fix build bug with CONFIG_SND_HDA_CODEC_SIGMATEL=y && !CONFIG_SND_HDA_GENERIC
  2007-10-18 13:37 ` Takashi Iwai
@ 2007-10-18 14:54   ` Ingo Molnar
  2007-10-18 14:18     ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Ingo Molnar @ 2007-10-18 14:54 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: linux-kernel, Jaroslav Kysela, Andrew Morton


* Takashi Iwai <tiwai@suse.de> wrote:

> +++ b/sound/pci/hda/patch_sigmatel.c	Thu Oct 18 16:23:22 2007 +0200
> @@ -3062,9 +3062,16 @@ static int patch_stac9872(struct hda_cod
>  	board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
>  						  stac9872_models,
>  						  stac9872_cfg_tbl);
> -	if (board_config < 0)
> +	if (board_config < 0) {
> +		printk(KERN_WARNING "hda-codec: "
> +		       "found unknown STAC9872 device\n");
> +#ifdef CONFIG_SND_HDA_GENERIC
>  		/* unknown config, let generic-parser do its job... */
>  		return snd_hda_parse_generic_codec(codec);
> +#else
> +		return -ENODEV;
> +#endif

pushing an #ifdef into a driver is quite unclean, if then you should 
define snd_hda_parse_generic_codec() in a header as a -ENODEV inline 
function if !CONFIG_SND_HDA_GENERIC.

	Ingo

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

end of thread, other threads:[~2007-10-18 15:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-18  9:50 [patch] snd: fix build bug with CONFIG_SND_HDA_CODEC_SIGMATEL=y && !CONFIG_SND_HDA_GENERIC Ingo Molnar
2007-10-18 13:37 ` Takashi Iwai
2007-10-18 14:54   ` Ingo Molnar
2007-10-18 14:18     ` 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®