Skip to contentSkip to conversation

swsusp: fix platform mode

PATCH New Stefan Seyfried 1 participant 1 message Oct 17, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 swsusp: fix platform mode

At some point after 2.6.13, in-kernel software suspend got "incomplete" for the so-called "platform" mode. pm_ops->prepare() is never called. A visible sign of this is the "moon" light on thinkpads not flashing during suspend. Fix by readding the pm_ops->prepare call during suspend.

---

 kernel/power/disk.c |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
kernel/power/disk.c +22 -0
@@ -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,15 @@ 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;
+
+	platform_finish();
 thaw:
 	thaw_processes();
 	enable_nonboot_cpus();
Signature · 3 lines
Stefan Seyfried
QA / R&D Team Mobile Devices        |              "Any ideas, John?"
SUSE LINUX Products GmbH, Nürnberg  | "Well, surrounding them's out."