Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S262817AbVAKQY5 (ORCPT ); Tue, 11 Jan 2005 11:24:57 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S262818AbVAKQY4 (ORCPT ); Tue, 11 Jan 2005 11:24:56 -0500 Received: from mail.suse.de ([195.135.220.2]:41645 "EHLO Cantor.suse.de") by vger.kernel.org with ESMTP id S262817AbVAKQYi (ORCPT ); Tue, 11 Jan 2005 11:24:38 -0500 Date: Tue, 11 Jan 2005 17:24:37 +0100 Message-ID: From: Takashi Iwai To: Lukas Hejtmanek Cc: linux-kernel@vger.kernel.org Subject: [PATCH] [ALSA] Fix Oops at resume In-Reply-To: <20050111102410.GB3013@mail.muni.cz> References: <20050111102410.GB3013@mail.muni.cz> User-Agent: Wanderlust/2.10.1 (Watching The Wheels) SEMI/1.14.5 (Awara-Onsen) FLIM/1.14.5 (Demachiyanagi) APEL/10.6 MULE XEmacs/21.4 (patch 15) (Security Through Obscurity) (i386-suse-linux) MIME-Version: 1.0 (generated by SEMI 1.14.5 - "Awara-Onsen") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2658 Lines: 86 At Tue, 11 Jan 2005 11:24:10 +0100, Lukas Hejtmanek wrote: > > Hello, > > Pavel Machek told me that you have patch solving oops in snd_ac97_resume in the > latest -bk kernel. Could you send it to me? Below is the patch. Takashi ================================================================ Summary: [ALSA] Fix Oops at resume Fixed Oops at resume on certain codecs. Set null ops when no patch exists or the patch doesn't set build_ops. Signed-off-by: Takashi Iwai --- linux/sound/pci/ac97/ac97_codec.c 4 Jan 2005 11:08:31 -0000 1.159 +++ linux/sound/pci/ac97/ac97_codec.c 10 Jan 2005 15:50:45 -0000 @@ -1505,7 +1505,7 @@ snd_ac97_update_bits(ac97, AC97_GENERAL_PURPOSE, ~AC97_GP_DRSS_MASK, 0x0000); /* build 3D controls */ - if (ac97->build_ops && ac97->build_ops->build_3d) { + if (ac97->build_ops->build_3d) { ac97->build_ops->build_3d(ac97); } else { if (snd_ac97_try_volume_mix(ac97, AC97_3D_CONTROL)) { @@ -1528,14 +1528,14 @@ /* build S/PDIF controls */ if (ac97->ext_id & AC97_EI_SPDIF) { - if (ac97->build_ops && ac97->build_ops->build_spdif) { + if (ac97->build_ops->build_spdif) { if ((err = ac97->build_ops->build_spdif(ac97)) < 0) return err; } else { for (idx = 0; idx < 5; idx++) if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_spdif[idx], ac97))) < 0) return err; - if (ac97->build_ops && ac97->build_ops->build_post_spdif) { + if (ac97->build_ops->build_post_spdif) { if ((err = ac97->build_ops->build_post_spdif(ac97)) < 0) return err; } @@ -1548,7 +1548,7 @@ } /* build chip specific controls */ - if (ac97->build_ops && ac97->build_ops->build_specific) + if (ac97->build_ops->build_specific) if ((err = ac97->build_ops->build_specific(ac97)) < 0) return err; @@ -1811,6 +1811,9 @@ return 0; } +/* build_ops to do nothing */ +static struct snd_ac97_build_ops null_build_ops; + /** * snd_ac97_mixer - create an Codec97 component * @bus: the AC97 bus which codec is attached to @@ -2050,6 +2053,9 @@ bus->ops->init(ac97); snd_ac97_get_name(ac97, ac97->id, name, !ac97_is_audio(ac97)); snd_ac97_get_name(NULL, ac97->id, name, !ac97_is_audio(ac97)); // ac97->id might be changed in the special setup code + if (! ac97->build_ops) + ac97->build_ops = &null_build_ops; + if (ac97_is_audio(ac97)) { char comp[16]; if (card->mixername[0] == '\0') { - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/