From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1763623AbXJRPHQ (ORCPT ); Thu, 18 Oct 2007 11:07:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755313AbXJRPHA (ORCPT ); Thu, 18 Oct 2007 11:07:00 -0400 Received: from mail.suse.de ([195.135.220.2]:52216 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754848AbXJRPG7 (ORCPT ); Thu, 18 Oct 2007 11:06:59 -0400 Date: Thu, 18 Oct 2007 16:18:10 +0200 Message-ID: From: Takashi Iwai To: Ingo Molnar Cc: linux-kernel@vger.kernel.org, Jaroslav Kysela , Andrew Morton Subject: Re: [patch] snd: fix build bug with CONFIG_SND_HDA_CODEC_SIGMATEL=y && !CONFIG_SND_HDA_GENERIC In-Reply-To: <20071018145458.GA1040@elte.hu> References: <20071018095042.GA21361@elte.hu> <20071018145458.GA1040@elte.hu> User-Agent: Wanderlust/2.15.5 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.7 (=?ISO-8859-4?Q?Sanj=F2?=) APEL/10.6 MULE XEmacs/21.5 (beta28) (fuki) (+CVS-20070806) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org At Thu, 18 Oct 2007 16:54:58 +0200, Ingo Molnar wrote: > > > * Takashi Iwai 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