This routine essentially duplicates the swsusp_suspend routine, which does
high level steps of the atomic copy. Rather than modifying that routine to
include a number of if (suspend2) else clauses, it seemed better to put a
suspend2ised copy here.
Signed-off-by: Nigel Cunningham <[email protected]>
kernel/power/atomic_copy.c | 31 +++++++++++++++++++++++++++++++
1 files changed, 31 insertions(+), 0 deletions(-)
diff --git a/kernel/power/atomic_copy.c b/kernel/power/atomic_copy.c
index 75e3beb..bb5d74f 100644
--- a/kernel/power/atomic_copy.c
+++ b/kernel/power/atomic_copy.c
@@ -349,3 +349,34 @@ void suspend_copy_pageset1(void)
}
}
+int suspend2_suspend(void)
+{
+ int error;
+
+ if ((error = arch_prepare_suspend()))
+ return error;
+ local_irq_disable();
+ /* At this point, device_suspend() has been called, but *not*
+ * device_power_down(). We *must* device_power_down() now.
+ * Otherwise, drivers for some devices (e.g. interrupt controllers)
+ * become desynchronized with the actual state of the hardware
+ * at resume time, and evil weirdness ensues.
+ */
+ if ((error = device_power_down(PMSG_FREEZE))) {
+ printk(KERN_ERR "Some devices failed to power down, aborting suspend\n");
+ goto enable_irqs;
+ }
+
+ save_processor_state();
+ if ((error = swsusp_arch_suspend()))
+ printk(KERN_ERR "Error %d suspending\n", error);
+ /* Restore control flow appears here */
+ restore_processor_state();
+ if (!suspend2_in_suspend)
+ copyback_high();
+ device_power_up();
+enable_irqs:
+ local_irq_enable();
+ return error;
+}
+
--
Nigel Cunningham nigel at suspend2 dot net
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]