From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: hda - Fix unbalanced runtime pm refount
Patch-mainline: Never
References: bnc#834742

The runtime PM refcount gets screwed up sometimes when S3/S4 is peformed
multiple times.  This leads to the controller in D3 while the codec is
powered up, resulting in the codec communication errors and repeated
sounds.

The patch is solely for SP3 kernel, and the upstream kernel doesn't need
this as the runtime PM core code seems working better there.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

---
 sound/pci/hda/hda_codec.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -4517,8 +4517,8 @@ static void hda_power_work(struct work_s
 	spin_unlock(&codec->power_lock);
 
 	state = hda_call_codec_suspend(codec, true);
-	codec->pm_down_notified = 0;
-	if (!bus->power_keep_link_on && (state & AC_PWRST_CLK_STOP_OK)) {
+	if (!codec->pm_down_notified &&
+	    !bus->power_keep_link_on && (state & AC_PWRST_CLK_STOP_OK)) {
 		codec->pm_down_notified = 1;
 		hda_call_pm_notify(bus, false);
 	}
