diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-08-16 16:35:33 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 15:59:07 +0200 |
commit | a221e287ab39a0d169809cb79536abd75392c3c1 (patch) | |
tree | bb3fc373c9057083525e65218c8020d44dc8a444 /sound/pci/hda/hda_codec.c | |
parent | 676a9b53dcb0843a98f7339a492e42baf4b9a734 (diff) |
[ALSA] hda-intel - Avoid unnecessary work scheduling
Avoid unnecessary work scheduling for power-off.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 0b9029436bb..b1eee9a044f 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c @@ -1664,6 +1664,7 @@ static void hda_call_codec_suspend(struct hda_codec *codec) #ifdef CONFIG_SND_HDA_POWER_SAVE cancel_delayed_work(&codec->power_work); codec->power_on = 0; + codec->power_transition = 0; #endif } @@ -2211,7 +2212,7 @@ static void hda_keep_power_on(struct hda_codec *codec) void snd_hda_power_up(struct hda_codec *codec) { codec->power_count++; - if (codec->power_on) + if (codec->power_on || codec->power_transition) return; codec->power_on = 1; @@ -2219,16 +2220,19 @@ void snd_hda_power_up(struct hda_codec *codec) codec->bus->ops.pm_notify(codec); hda_call_codec_resume(codec); cancel_delayed_work(&codec->power_work); + codec->power_transition = 0; } void snd_hda_power_down(struct hda_codec *codec) { --codec->power_count; - if (!codec->power_on || codec->power_count) + if (!codec->power_on || codec->power_count || codec->power_transition) return; - if (power_save) + if (power_save) { + codec->power_transition = 1; /* avoid reentrance */ schedule_delayed_work(&codec->power_work, msecs_to_jiffies(power_save * 1000)); + } } int snd_hda_check_amp_list_power(struct hda_codec *codec, |