From: Takashi Iwai Subject: Re: [PATCH] ASoC force running of delayed PM work at suspend() and remove() Date: Thu, 01 Feb 2007 12:13:31 +0100 Message-ID: References: <1170246385.16760.51.camel@localhost.localdomain> <1170264157.16760.89.camel@localhost.localdomain> <1170265146.16760.93.camel@localhost.localdomain> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1170265146.16760.93.camel@localhost.localdomain> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@lists.sourceforge.net Errors-To: alsa-devel-bounces@lists.sourceforge.net To: Liam Girdwood Cc: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Wed, 31 Jan 2007 17:39:06 +0000, Liam Girdwood wrote: > > 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. Well, in the case of ac97_codec.c, we don't have to put schedule_delayed_work() there. The work is only for power-off, and suspend/powerdown is the very place to force to turn off the power immediately afterward. Takashi > > Signed-off-by: Liam Girdwood > > Liam > [2 ac97-delayed-work.patch ] > 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); > } ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier. Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642