From 2525fdc42fdc4bb943ec2fa5a37e2ae139e1b6d3 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 15 Aug 2007 22:18:22 +0200 Subject: [PATCH] [ALSA] hda-intel - Add flush_scheduled_work() in snd_hda_codec_free() Added flush_scheduled_work() in snd_hda_codec_free() to make sure that the all work is gone. Also, optimized the condition to schedule the delayed work in snd_hda_power_down(). Signed-off-by: Takashi Iwai Signed-off-by: Jaroslav Kysela --- sound/pci/hda/hda_codec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 0e923f3f0a..0b9029436b 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -525,6 +525,7 @@ static void snd_hda_codec_free(struct hda_codec *codec) return; #ifdef CONFIG_SND_HDA_POWER_SAVE cancel_delayed_work(&codec->power_work); + flush_scheduled_work(); #endif list_del(&codec->list); codec->bus->caddr_tbl[codec->addr] = NULL; @@ -2223,7 +2224,7 @@ void snd_hda_power_up(struct hda_codec *codec) void snd_hda_power_down(struct hda_codec *codec) { --codec->power_count; - if (!codec->power_on) + if (!codec->power_on || codec->power_count) return; if (power_save) schedule_delayed_work(&codec->power_work, -- 2.39.5