lkml.org 
[lkml]   [2006]   [Jun]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[Suspend2][ 02/16] [Suspend2] Routines called when starting or finishing anything.
Date
Routines called when starting or completing any action.

Signed-off-by: Nigel Cunningham <nigel@suspend2.net>

kernel/power/suspend.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 51 insertions(+), 0 deletions(-)
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
index 28bb91c..01c930a 100644
--- a/kernel/power/suspend.c
+++ b/kernel/power/suspend.c
@@ -180,3 +180,54 @@ extern int block_dump;

int block_dump_save;

+/*
+ * Basic clean-up routine.
+ */
+void suspend_finish_anything(int finishing_cycle)
+{
+ if (atomic_dec_and_test(&actions_running)) {
+ suspend_cleanup_modules(finishing_cycle);
+ suspend_put_modules();
+ clear_suspend_state(SUSPEND_RUNNING);
+ }
+
+ set_fs(oldfs);
+
+ if (finishing_cycle)
+ block_dump = block_dump_save;
+}
+
+/*
+ * Basic set-up routine.
+ */
+int suspend_start_anything(int starting_cycle)
+{
+ oldfs = get_fs();
+
+ if (atomic_add_return(1, &actions_running) == 1) {
+ set_fs(KERNEL_DS);
+
+ set_suspend_state(SUSPEND_RUNNING);
+
+ if (suspend_get_modules()) {
+ printk("Get modules failed!\n");
+ clear_suspend_state(SUSPEND_RUNNING);
+ set_fs(oldfs);
+ return -EBUSY;
+ }
+
+ if (suspend_initialise_modules(starting_cycle)) {
+ printk("Initialise modules failed!\n");
+ suspend_finish_anything(starting_cycle);
+ return -EBUSY;
+ }
+
+ if (starting_cycle) {
+ block_dump_save = block_dump;
+ block_dump = 0;
+ }
+ }
+
+ return 0;
+}
+
--
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 majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-06-27 01:44    [from the cache]
©2003-2011 Jasper Spaans