First cut of catch up patch.

Nigel Cunningham <[email protected]>
Newsgroups gmane.linux.swsusp.devel
Message-ID <[email protected]>
Hi all.

Here's a first cut of the catch-up patch. I've not had the opportunity
to test it yet, but thought I'd throw it out there anyway for those of
you who are so keen to try the latest and greatest. Shouldn't eat your
children or anything like that, but you've been warned that I haven't
given it the chance to eat mine yet...

Regards,

Nigel
-- 
Evolution (n): A hypothetical process whereby improbable
events occur with alarming frequency, order arises from chaos, and
no one is given credit.

_______________________________________________
TuxOnIce-devel mailing list
[email protected]
http://lists.tuxonice.net/listinfo/tuxonice-devel
catchup.patch (text/x-diff, 3.6 KB)
diff --git a/kernel/power/tuxonice_atomic_copy.c b/kernel/power/tuxonice_atomic_copy.c
index c9c91b8..7f53c6a 100644
--- a/kernel/power/tuxonice_atomic_copy.c
+++ b/kernel/power/tuxonice_atomic_copy.c
@@ -340,23 +340,37 @@ Failed:
  **/
 int toi_go_atomic(pm_message_t state, int suspend_time)
 {
-	if (suspend_time) {
-		if (platform_begin(1)) {
-			set_abort_result(TOI_PLATFORM_PREP_FAILED);
-			toi_end_atomic(ATOMIC_STEP_PLATFORM_END, suspend_time, 3);
-			return 1;
-		}
-
-		/* dpm_prepare done earlier */
-	}
+  if (suspend_time) {
+    if (platform_begin(1)) {
+      set_abort_result(TOI_PLATFORM_PREP_FAILED);
+      toi_end_atomic(ATOMIC_STEP_PLATFORM_END, suspend_time, 3);
+      return 1;
+    }
+
+    if (dpm_prepare(PMSG_FREEZE)) {
+      set_abort_result(TOI_DPM_PREPARE_FAILED);
+      dpm_complete(PMSG_RECOVER);
+      toi_end_atomic(ATOMIC_STEP_PLATFORM_END, suspend_time, 3);
+      return 1;
+    }
+  }
 
 	suspend_console();
-
-	if (dpm_suspend(state)) {
-		set_abort_result(TOI_DPM_SUSPEND_FAILED);
-		toi_end_atomic(ATOMIC_STEP_DEVICE_RESUME, suspend_time, 3);
-		return 1;
-	}
+	pm_restrict_gfp_mask();
+
+  if (suspend_time) {
+    if (dpm_suspend(state)) {
+      set_abort_result(TOI_DPM_SUSPEND_FAILED);
+      toi_end_atomic(ATOMIC_STEP_DEVICE_RESUME, suspend_time, 3);
+      return 1;
+    }
+  } else {
+    if (dpm_suspend_start(state)) {
+      set_abort_result(TOI_DPM_SUSPEND_FAILED);
+      toi_end_atomic(ATOMIC_STEP_DEVICE_RESUME, suspend_time, 3);
+      return 1;
+    }
+  }
 
 	/* At this point, dpm_suspend_start() has been called, but *not*
 	 * dpm_suspend_noirq(). We *must* dpm_suspend_noirq() now.
@@ -401,7 +415,7 @@ int toi_go_atomic(pm_message_t state, int suspend_time)
 		return 1;
 	}
 
-	if (pm_wakeup_pending()) {
+	if (suspend_time && pm_wakeup_pending()) {
 		set_abort_result(TOI_WAKEUP_EVENT);
 		toi_end_atomic(ATOMIC_STEP_SYSCORE_RESUME, suspend_time, 1);
 		return 1;
@@ -443,6 +457,8 @@ void toi_end_atomic(int stage, int suspend_time, int error)
 		if (suspend_time && (error & 2))
 			platform_recover(1);
 		dpm_resume(msg);
+    if (error || !in_suspend)
+      pm_restore_gfp_mask();
 		resume_console();
 	case ATOMIC_STEP_DPM_COMPLETE:
 		dpm_complete(msg);
diff --git a/kernel/power/tuxonice_builtin.c b/kernel/power/tuxonice_builtin.c
index 655eca4..70f7f98 100644
--- a/kernel/power/tuxonice_builtin.c
+++ b/kernel/power/tuxonice_builtin.c
@@ -272,8 +272,6 @@ int toi_lowlevel_builtin(void)
 	}
 
 	restore_processor_state();
-	touch_softlockup_watchdog();
-
 	return error;
 }
 EXPORT_SYMBOL_GPL(toi_lowlevel_builtin);
diff --git a/kernel/power/tuxonice_highlevel.c b/kernel/power/tuxonice_highlevel.c
index d55c333..7d5b0ba 100644
--- a/kernel/power/tuxonice_highlevel.c
+++ b/kernel/power/tuxonice_highlevel.c
@@ -831,14 +831,6 @@ static int do_prepare_image(void)
 
 	trap_non_toi_io = 1;
 
-	if (dpm_prepare(PMSG_FREEZE)) {
-		set_abort_result(TOI_DPM_PREPARE_FAILED);
-		dpm_complete(PMSG_FREEZE);
-		return 1;
-	}
-
-	pm_restrict_gfp_mask();
-
 	return 0;
 }
 
diff --git a/kernel/power/tuxonice_io.c b/kernel/power/tuxonice_io.c
index 2c8f027..335d5f5 100644
--- a/kernel/power/tuxonice_io.c
+++ b/kernel/power/tuxonice_io.c
@@ -1691,6 +1691,10 @@ static int __read_pageset1(void)
 		}
 	}
 
+	result = pm_notifier_call_chain(PM_RESTORE_PREPARE);
+	if (result)
+		goto out_notifier_call_chain;;
+
 	if (usermodehelper_disable())
 		goto out_enable_nonboot_cpus;
 
@@ -1761,6 +1765,8 @@ out_thaw:
 	usermodehelper_enable();
 out_enable_nonboot_cpus:
 	enable_nonboot_cpus();
+out_notifier_call_chain:
+  pm_notifier_call_chain(PM_POST_RESTORE);
 out_reset_console:
 	toi_cleanup_console();
 out_remove_image:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.