snd: fix build bug with CONFIG_SND_HDA_CODEC_SIGMATEL=y && !CONFIG_SND_HDA_GENERIC
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
@@ -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
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 withCONFIG_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.cdepends onSND_HDA_GENERIC, forsnd_hda_parse_generic_codec().to make it selectable, reorder
SND_HDA_CODEC_SIGMATELto afterSND_HDA_GENERIC.with this fixed, the kernel builds fine.
Signed-off-by Ingo Molnar <[email protected]>
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
@@ -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 )
Quoted 5 lines · Takashi Iwai
+++
b/sound/pci/hda/patch_sigmatel.cThu Oct 18 16:23:22 2007 +0200sound/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
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.cThu 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
-0return snd_hda_parse_generic_codec(codec); +#else + return -ENODEV; +#endifpushing an #ifdef into a driver is quite unclean, if then you should define
snd_hda_parse_generic_codec()in a header as a-ENODEVinline 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
@@ -626,24 +626,19 @@ int __devinit snd_hda_codec_new(struct hsnd_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
@@ -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