]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - kernel/power/disk.c
Hibernation: Introduce system_entering_hibernation
[linux-2.6-omap-h63xx.git] / kernel / power / disk.c
index f77d3819ef57b2407012fbbf431f27add286fe91..432ee575c9ee4fd201481a9ebdb674c29b96dab8 100644 (file)
@@ -71,6 +71,14 @@ void hibernation_set_ops(struct platform_hibernation_ops *ops)
        mutex_unlock(&pm_mutex);
 }
 
+static bool entering_platform_hibernation;
+
+bool system_entering_hibernation(void)
+{
+       return entering_platform_hibernation;
+}
+EXPORT_SYMBOL(system_entering_hibernation);
+
 #ifdef CONFIG_PM_DEBUG
 static void hibernation_debug_sleep(void)
 {
@@ -258,12 +266,12 @@ int hibernation_snapshot(int platform_mode)
 {
        int error;
 
-       /* Free memory before shutting down devices. */
-       error = swsusp_shrink_memory();
+       error = platform_begin(platform_mode);
        if (error)
                return error;
 
-       error = platform_begin(platform_mode);
+       /* Free memory before shutting down devices. */
+       error = swsusp_shrink_memory();
        if (error)
                goto Close;
 
@@ -411,6 +419,7 @@ int hibernation_platform_enter(void)
        if (error)
                goto Close;
 
+       entering_platform_hibernation = true;
        suspend_console();
        error = device_suspend(PMSG_HIBERNATE);
        if (error) {
@@ -445,6 +454,7 @@ int hibernation_platform_enter(void)
  Finish:
        hibernation_ops->finish();
  Resume_devices:
+       entering_platform_hibernation = false;
        device_resume(PMSG_RESTORE);
        resume_console();
  Close: