From: Dylan Reid <[email protected]>

commit b43d224767e426cf1a8b6622d1d172f2b2b0e857 upstream.

After cancel_delayed_work_sync returns, the power down work either never
started (power_on == 1) or finished (power_on == 0).  In the former case
there is no need to power up again.

[Note: we faced a regression in 3.5 kernel by the commit [b4a91cf0:
 ALSA: hda - Handle open while transitioning to D3], likely because of
 the parallel power-up sequences, and found that this optimization for
 3.6 kernel cures it.]

Signed-off-by: Dylan Reid <[email protected]>
Signed-off-by: Takashi Iwai <[email protected]>
---

Greg, please take this one to 3.5.x stable tree as a regression fix.
It's only for 3.5.  3.4 and earlier don't need it.

Thanks,

Takashi

 sound/pci/hda/hda_codec.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 604699c..045b5e7 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -4444,6 +4444,13 @@ static void __snd_hda_power_up(struct hda_codec *codec, 
bool wait_power_down)
        cancel_delayed_work_sync(&codec->power_work);
 
        spin_lock(&codec->power_lock);
+       /* If the power down delayed work was cancelled above before starting,
+        * then there is no need to go through power up here.
+        */
+       if (codec->power_on) {
+               spin_unlock(&codec->power_lock);
+               return;
+       }
        trace_hda_power_up(codec);
        snd_hda_update_power_acct(codec);
        codec->power_on = 1;
-- 
1.7.10.4

--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to