--- init/do_mounts.c.orig 2005-03-17 17:34:09.000000000 -0800 +++ init/do_mounts.c 2005-04-01 19:29:23.000000000 -0800 @@ -362,6 +362,16 @@ void __init mount_root(void) { +#ifdef CONFIG_SOFTWARE_SUSPEND + /* + * Must resume after initrd has loaded the device for the root filesys, + * presumed same as the one with the swap partition with the resume + * image, but before mounting anything, which resuming would smear. + */ + software_resume(); +#endif #ifdef CONFIG_ROOT_NFS if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) { if (mount_nfs_root()) --- include/linux/suspend.h.orig 2005-03-17 17:34:07.000000000 -0800 +++ include/linux/suspend.h 2005-04-01 19:39:35.000000000 -0800 @@ -48,6 +48,7 @@ #ifdef CONFIG_PM /* kernel/power/swsusp.c */ extern int software_suspend(void); +extern int software_resume(void); extern int pm_prepare_console(void); extern void pm_restore_console(void); @@ -58,6 +59,10 @@ printk("Warning: fake suspend called\n"); return -EPERM; } +static inline int software_resume(void) +{ + return 0; +} #endif #ifdef CONFIG_SMP --- kernel/power/disk.c.orig 2005-03-26 14:16:25.000000000 -0800 +++ kernel/power/disk.c 2005-04-01 21:14:01.029535791 -0800 @@ -229,7 +229,7 @@ * */ -static int software_resume(void) +int software_resume(void) { int error; @@ -243,12 +243,15 @@ pr_debug("PM: Checking swsusp image.\n"); - if ((error = swsusp_check())) + if ((error = swsusp_check())) { + pr_debug("PM: No swsusp image, skipping.\n"); goto Done; + } pr_debug("PM: Preparing processes for restore.\n"); if ((error = prepare_processes())) { + pr_debug("PM: Problem preparing processes, not restoring.\n"); swsusp_close(); goto Cleanup; } @@ -278,8 +281,6 @@ return 0; } -late_initcall(software_resume); - static char * pm_disk_modes[] = { [PM_DISK_FIRMWARE] = "firmware",