Re: [PATCH] ASoC force running of delayed PM work at suspend() and remove()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2007-01-31 at 17:22 +0000, Liam Girdwood wrote:

> Patch attached for AC97 codec.

Best use this one. I've now put the #ifdef CONFIG_SND_AC97_POWER_SAVE
around the function.

Signed-off-by: Liam Girdwood <lg@xxxxxxxxxxxxxxxxxxxxxxxxxxx>

Liam
diff -r 2a5adb550155 pci/ac97/ac97_codec.c
--- a/pci/ac97/ac97_codec.c	Wed Jan 31 14:34:38 2007 +0100
+++ b/pci/ac97/ac97_codec.c	Wed Jan 31 17:36:31 2007 +0000
@@ -964,6 +964,23 @@ AD18XX_PCM_BITS("LFE Playback Volume", 2
 /*
  *
  */
+#ifdef CONFIG_SND_AC97_POWER_SAVE
+static int run_ac97_delayed_work(struct delayed_work *dwork)
+{
+	int ret;
+
+	/* cancel any work waiting to be queued. */
+	ret = cancel_delayed_work(dwork);
+
+	/* if there was any work waiting then we run it now and
+	 * wait for it's completion */
+	if (ret) {
+		schedule_delayed_work(dwork, 0);
+		flush_scheduled_work();
+	}
+	return ret;
+}
+#endif
 
 static void snd_ac97_powerdown(struct snd_ac97 *ac97);
 
@@ -989,8 +1006,7 @@ static int snd_ac97_free(struct snd_ac97
 {
 	if (ac97) {
 #ifdef CONFIG_SND_AC97_POWER_SAVE
-		cancel_delayed_work(&ac97->power_work);
-		flush_scheduled_work();
+		run_ac97_delayed_work(&ac97->power_work);
 #endif
 		snd_ac97_proc_done(ac97);
 		if (ac97->bus)
@@ -2417,8 +2433,7 @@ void snd_ac97_suspend(struct snd_ac97 *a
 	if (ac97->build_ops->suspend)
 		ac97->build_ops->suspend(ac97);
 #ifdef CONFIG_SND_AC97_POWER_SAVE
-	cancel_delayed_work(&ac97->power_work);
-	flush_scheduled_work();
+	run_ac97_delayed_work(&ac97->power_work);
 #endif
 	snd_ac97_powerdown(ac97);
 }
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux