aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-07-03 11:36:35 -0400
committerTakashi Iwai <tiwai@suse.de>2012-07-03 12:31:37 -0400
commit3fd877d32cac31292628fb8f443543fc1989b49b (patch)
tree701577fff092c38cc09b9d571b76c733c4c76b09
parent257dfb410070b48e377c7894222b73ca41d662e0 (diff)
ALSA: hda - Avoid possible race of beep on/off
Call cancel_work_sync() when turning off the beep switch so that the mute call is executed in a proper order. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_beep.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index e6cf2a22c407..0bc2315b181d 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -165,12 +165,13 @@ static int snd_hda_do_attach(struct hda_beep *beep)
165int snd_hda_enable_beep_device(struct hda_codec *codec, int enable) 165int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
166{ 166{
167 struct hda_beep *beep = codec->beep; 167 struct hda_beep *beep = codec->beep;
168 enable = !!enable; 168 if (!beep)
169 if (beep == NULL)
170 return 0; 169 return 0;
170 enable = !!enable;
171 if (beep->enabled != enable) { 171 if (beep->enabled != enable) {
172 beep->enabled = enable; 172 beep->enabled = enable;
173 if (!enable) { 173 if (!enable) {
174 cancel_work_sync(&beep->beep_work);
174 /* turn off beep */ 175 /* turn off beep */
175 snd_hda_codec_write(beep->codec, beep->nid, 0, 176 snd_hda_codec_write(beep->codec, beep->nid, 0,
176 AC_VERB_SET_BEEP_CONTROL, 0); 177 AC_VERB_SET_BEEP_CONTROL, 0);