On Monday, 16 October 2006 21:21, Stefan Seyfried wrote:
> On Mon, Oct 16, 2006 at 09:06:07PM +0200, R. J. Wysocki wrote:
> > On Monday, 16 October 2006 20:55, Stefan Seyfried wrote:
> > > Hi,
> > > 
> > > If nobody objects, i'd send this to LKML:
> > > Maybe somebody with a recent -mm kernel can test if it still applies 
> > > there :-)
> > 
> > I have a very similar patch, but with two differences, that applies to -mm
> > and has been tested (on one box):
> 
> ok, even better. My patch is still compiling, but i have no machine here where
> i can test its effectiveness (on a thinkpad, you see the moon blink after
> pm_ops->prepare(), but i only get to one tomorrow ;-)

When you can, please test my patch and I'll post it to LKML if it works.
 
> > ---
> >  kernel/power/disk.c |   24 +++++++++++++++++++++++-
> >  1 file changed, 23 insertions(+), 1 deletion(-)
> > 
> > Index: linux-2.6.19-rc1-mm1/kernel/power/disk.c
> > ===================================================================
> > --- linux-2.6.19-rc1-mm1.orig/kernel/power/disk.c
> > +++ linux-2.6.19-rc1-mm1/kernel/power/disk.c
> > @@ -30,6 +30,22 @@ dev_t swsusp_resume_device;
> >  sector_t swsusp_resume_block;
> >  
> >  /**
> > + * platform_prepare - prepare the machine for hibernation using the
> > + * platform driver if so configured and return an error code if it fails
> > + */
> > +
> > +static inline int platform_prepare(void)
> > +{
> > +   int error = 0;
> > +
> > +   if (pm_disk_mode == PM_DISK_PLATFORM) {
> > +           if (pm_ops && pm_ops->prepare)
> > +                   error = pm_ops->prepare(PM_SUSPEND_DISK);
> > +   }
> > +   return error;
> > +}
> > +
> > +/**
> >   * power_down - Shut machine down for hibernate.
> >   * @mode:          Suspend-to-disk mode
> >   *
> > @@ -92,8 +108,14 @@ static int prepare_processes(void)
> >     }
> >  
> >     /* Free memory before shutting down devices. */
> > -   if (!(error = swsusp_shrink_memory()))
> > +   error = swsusp_shrink_memory();
> > +   if (error)
> > +           goto thaw;
> > +
> > +   error = platform_prepare();
> > +   if (!error)
> >             return 0;
> > +
> >  thaw:
> >     thaw_processes();
> >  enable_cpus:
> 
> I think you should do platform_finish() in the failure path also, but have
> not looked at the ACPI spec on the exact way how this should be called.

Do you mean platform_finish is also needed when platform_prepare fails?


-- 
You never change things by fighting the existing reality.
                R. Buckminster Fuller

-------------------------------------------------------------------------
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
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to