Hi,

i finally tested it and it seems to work.

> +     case SNAPSHOT_POWEROFF:
> +             if (pm_disk_mode == PM_DISK_PLATFORM) {
> +                     kernel_shutdown_prepare(SYSTEM_SUSPEND_DISK);
> +                     error = pm_ops->enter(PM_SUSPEND_DISK);
> +             } else {
> +                     kernel_power_off();
> +             }
> +             break;
> +
> +     case SNAPSHOT_POWERUP:
> +             if (pm_disk_mode == PM_DISK_PLATFORM) {
> +                     if (pm_ops && pm_ops->finish)
> +                             pm_ops->finish(PM_SUSPEND_DISK);
> +             }

a break is missing here.

>       default:
>               error = -ENOTTY;
>  

This is the accompanying userspace change (yes, with ugly debug stuff in
there):

Index: resume.c
===================================================================
RCS file: /cvsroot/suspend/suspend/resume.c,v
retrieving revision 1.27
diff -u -p -r1.27 resume.c
--- resume.c    23 Jul 2006 11:32:52 -0000      1.27
+++ resume.c    12 Sep 2006 06:49:54 -0000
@@ -769,6 +769,7 @@ int main(int argc, char *argv[])
                fprintf(stderr, "resume: Could not freeze processes\n");
                goto Close;
        }
+       platform_finish(dev);
        atomic_restore(dev);
        unfreeze(dev);
        splash.finish();
Index: suspend.c
===================================================================
RCS file: /cvsroot/suspend/suspend/suspend.c,v
retrieving revision 1.48
diff -u -p -r1.48 suspend.c
--- suspend.c   23 Jul 2006 11:32:52 -0000      1.48
+++ suspend.c   12 Sep 2006 06:49:55 -0000
@@ -636,9 +636,10 @@ static int reset_signature(int fd)
 }
 #endif
 
-static void suspend_shutdown(void)
+static void suspend_shutdown(int dev)
 {
-       power_off();
+       printf("userspace: executing %s\n", __FUNCTION__);
+       ioctl(dev, SNAPSHOT_POWEROFF);
        /* Signature is on disk, it is very dangerous to continue now.
         * We'd do resume with stale caches on next boot. */
        printf("Powerdown failed. That's impossible.\n");
@@ -694,14 +695,14 @@ int suspend_system(int snapshot_fd, int 
                                splash.progress(100);
 #ifdef CONFIG_BOTH
                                if (!s2ram) {
-                                       suspend_shutdown();
+                                       suspend_shutdown(snapshot_fd);
                                } else {
                                        /* If we die (and allow system to 
continue) between
                                          * now and reset_signature(), very bad 
things will
                                          * happen. */
                                        error = suspend_to_ram(snapshot_fd);
                                        if (error)
-                                               suspend_shutdown();
+                                               suspend_shutdown(snapshot_fd);
                                        reset_signature(resume_fd);
                                        free_swap_pages(snapshot_fd);
                                        free_snapshot(snapshot_fd);
@@ -709,7 +710,7 @@ int suspend_system(int snapshot_fd, int 
                                        goto Unfreeze;
                                }
 #else
-                               suspend_shutdown();
+                               suspend_shutdown(snapshot_fd);
 #endif
                        } else {
                                free_swap_pages(snapshot_fd);
Index: swsusp.h
===================================================================
RCS file: /cvsroot/suspend/suspend/swsusp.h,v
retrieving revision 1.25
diff -u -p -r1.25 swsusp.h
--- swsusp.h    3 Sep 2006 22:04:34 -0000       1.25
+++ swsusp.h    12 Sep 2006 06:49:55 -0000
@@ -26,7 +26,9 @@
 #define SNAPSHOT_FREE_SWAP_PAGES       _IO(SNAPSHOT_IOC_MAGIC, 9)
 #define SNAPSHOT_SET_SWAP_FILE         _IOW(SNAPSHOT_IOC_MAGIC, 10, unsigned 
int)
 #define SNAPSHOT_S2RAM                 _IO(SNAPSHOT_IOC_MAGIC, 11)
-#define SNAPSHOT_IOC_MAXNR     11
+#define SNAPSHOT_POWEROFF              _IO(SNAPSHOT_IOC_MAGIC, 12)
+#define SNAPSHOT_POWERUP               _IO(SNAPSHOT_IOC_MAGIC, 13)
+#define SNAPSHOT_IOC_MAXNR     13
 
 #define        LINUX_REBOOT_MAGIC1     0xfee1dead
 #define        LINUX_REBOOT_MAGIC2     672274793
@@ -98,6 +100,12 @@ static inline int atomic_restore(int dev
        return ioctl(dev, SNAPSHOT_ATOMIC_RESTORE, 0);
 }
 
+static inline void platform_finish(int dev)
+{
+       printf("userspace: executing %s\n", __FUNCTION__);
+       ioctl (dev, SNAPSHOT_POWERUP);
+}
+
 static inline int free_snapshot(int dev)
 {
        return ioctl(dev, SNAPSHOT_FREE, 0);
@@ -119,11 +127,13 @@ static inline void reboot(void)
                LINUX_REBOOT_CMD_RESTART, 0);
 }
 
+#if 0
 static inline void power_off(void)
 {
        syscall(SYS_reboot, LINUX_REBOOT_MAGIC1, LINUX_REBOOT_MAGIC2,
                LINUX_REBOOT_CMD_POWER_OFF, 0);
 }
+#endif
 
 #ifndef SYS_sync_file_range
  #ifdef __i386__

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