On Tue, Oct 17, 2006 at 02:42:12PM +0200, Rafael J. Wysocki wrote:
> On Tuesday, 17 October 2006 08:41, Stefan Seyfried wrote:
 
> > I did not forget this one, but will test later today.
> 
> OK

I tested it and it works. The moon only starts blinking after "shrinking
memory" which might take some time, so i reordered it a little bit. It even
makes the patch smaller:

Signed-off-by: Stefan Seyfried <[EMAIL PROTECTED]>

--- linux-2.6.18-14/kernel/power/disk.c 2006-09-20 05:42:06.000000000 +0200
+++ linux-2.6.18.new/kernel/power/disk.c        2006-10-17 16:16:56.000000000 
+0200
@@ -27,6 +27,22 @@ char resume_file[256] = CONFIG_PM_STD_PA
 dev_t swsusp_resume_device;
 
 /**
+ *     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
  *
@@ -79,9 +95,14 @@ static int prepare_processes(void)
                goto thaw;
        }
 
+       error = platform_prepare();
+       if (error)
+               goto thaw;
+
        /* Free memory before shutting down devices. */
        if (!(error = swsusp_shrink_memory()))
                return 0;
+
 thaw:
        thaw_processes();
        enable_nonboot_cpus();


> > So this looks ok. No, i do not want to look at ACPI spec :-)
> 
> \metoo

:-)

For reference, this is the diff of this function (with the above patch)
against a 2.6.13 (the last one i found around here that had this working, the
kernel of suse 10.0, after that it disappeared before 2.6.16):

#  static int prepare_processes(void)
#  {
#         int error;
# 
#         pm_prepare_console();
# -
# -       sys_sync();
# -
#         disable_nonboot_cpus();
# 
#         if (freeze_processes()) {
# @@ -138,16 +95,14 @@ static int prepare_processes(void)
#                 goto thaw;
#         }
# 
# -       if (pm_disk_mode == PM_DISK_PLATFORM) {
# -               if (pm_ops && pm_ops->prepare) {
# -                       if ((error = pm_ops->prepare(PM_SUSPEND_DISK)))
# -                               goto thaw;
# -               }
# -       }
# +       error = platform_prepare();
# +       if (error)
# +               goto thaw;
# 
#         /* Free memory before shutting down devices. */
# -       free_some_memory();
# -       return 0;
# +       if (!(error = swsusp_shrink_memory()))
# +               return 0;
# +
#  thaw:
#         thaw_processes();
#         enable_nonboot_cpus();
# @@ -163,15 +118,6 @@ static void unprepare_processes(void)
#         pm_restore_console();
#  }

So now it does the same than before the mysterious disappearance of 
pm_ops->prepare() ;-)
-- 
Stefan Seyfried
QA / R&D Team Mobile Devices        |              "Any ideas, John?"
SUSE LINUX Products GmbH, Nürnberg  | "Well, surrounding them's out." 

-------------------------------------------------------------------------
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