Commit 2525fdc4 authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[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: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 983f8ae4
...@@ -525,6 +525,7 @@ static void snd_hda_codec_free(struct hda_codec *codec) ...@@ -525,6 +525,7 @@ static void snd_hda_codec_free(struct hda_codec *codec)
return; return;
#ifdef CONFIG_SND_HDA_POWER_SAVE #ifdef CONFIG_SND_HDA_POWER_SAVE
cancel_delayed_work(&codec->power_work); cancel_delayed_work(&codec->power_work);
flush_scheduled_work();
#endif #endif
list_del(&codec->list); list_del(&codec->list);
codec->bus->caddr_tbl[codec->addr] = NULL; codec->bus->caddr_tbl[codec->addr] = NULL;
...@@ -2223,7 +2224,7 @@ void snd_hda_power_up(struct hda_codec *codec) ...@@ -2223,7 +2224,7 @@ void snd_hda_power_up(struct hda_codec *codec)
void snd_hda_power_down(struct hda_codec *codec) void snd_hda_power_down(struct hda_codec *codec)
{ {
--codec->power_count; --codec->power_count;
if (!codec->power_on) if (!codec->power_on || codec->power_count)
return; return;
if (power_save) if (power_save)
schedule_delayed_work(&codec->power_work, schedule_delayed_work(&codec->power_work,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment