[PATCH] Add include/linux/freezer.h and move definitions from sched.h
[deliverable/linux.git] / kernel / power / disk.c
index d79feeb45459f49ac0856e49d604255cfe768646..53b3b57c02238a860e1801bf5830581df7603cfc 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/pm.h>
 #include <linux/console.h>
 #include <linux/cpu.h>
+#include <linux/freezer.h>
 
 #include "power.h"
 
@@ -29,6 +30,22 @@ char resume_file[256] = CONFIG_PM_STD_PARTITION;
 dev_t swsusp_resume_device;
 sector_t swsusp_resume_block;
 
+/**
+ *     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
@@ -91,9 +108,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_cpus:
This page took 0.034018 seconds and 5 git commands to generate.