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?
--
Luk?? Hejtm?nek
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 <[email protected]>
--- 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') {