Skip to contentSkip to conversation

snd: fix build bug with CONFIG_SND_HDA_CODEC_SIGMATEL=y && !CONFIG_SND_HDA_GENERIC

PATCH In review Ingo Molnar 2 participants 4 messages Oct 18, 2007 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 snd: fix build bug with CONFIG_SND_HDA_CODEC_SIGMATEL=y && !CONFIG_SND_HDA_GENERIC

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 <[email protected]>

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.

---
 sound/pci/Kconfig |   17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
sound/pci/Kconfig +9 -8
Index: 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
#1 lore raw

At Thu, 18 Oct 2007 11:50:42 +0200,

Quoted 13 lines · Ingo Molnar

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 <[email protected]>

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'

Quoted 8 lines

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.

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

sound/pci/hda/patch_sigmatel.c +8 -1
diff -r fb9512ce24e0 sound/pci/hda/patch_sigmatel.c
@@ -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)
#2 lore raw
Quoted 5 lines · Takashi Iwai

+++ b/sound/pci/hda/patch_sigmatel.c Thu Oct 18 16:23:22 2007 +0200

sound/pci/hda/patch_sigmatel.c +0 -0
@@ -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);

sound/pci/hda/patch_sigmatel.c static int patch_stac9872(struct hda_cod · line 3073

Quoted 10 lines
sound/pci/hda/patch_sigmatel.c +7 -1
-	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

#3 lore raw

At Thu, 18 Oct 2007 16:54:58 +0200,

Quoted 15 lines · Ingo Molnar
Quoted 11 lines · Takashi Iwai

+++ b/sound/pci/hda/patch_sigmatel.c Thu Oct 18 16:23:22 2007 +0200

(quoted diff) +4 -1
@@ -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... */
Quoted 8 lines

Review static int patch_stac9872(struct hda_cod · line 3073

Quoted 4 lines
(quoted diff) +3 -0
 		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

pci/hda/hda_codec.c +2 -7
diff -r fb9512ce24e0 pci/hda/hda_codec.c
@@ -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) {
pci/hda/hda_local.h +7 -0
diff -r fb9512ce24e0 pci/hda/hda_local.h
@@ -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