Routines to iterate through the list of suspend2 modules, calling their
initialisation and cleanup routines.
Signed-off-by: Nigel Cunningham <[email protected]>
kernel/power/modules.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 49 insertions(+), 0 deletions(-)
diff --git a/kernel/power/modules.c b/kernel/power/modules.c
index af237b6..cd171a8 100644
--- a/kernel/power/modules.c
+++ b/kernel/power/modules.c
@@ -219,6 +219,55 @@ void suspend_move_module_tail(struct sus
list_move_tail(&module->module_list, &suspend_modules);
}
+/*
+ * suspend_initialise_modules
+ *
+ * Get ready to do some work!
+ */
+int suspend_initialise_modules(int starting_cycle)
+{
+ struct suspend_module_ops *this_module;
+ int result;
+
+ list_for_each_entry(this_module, &suspend_modules, module_list) {
+ if (this_module->disabled)
+ continue;
+ if (this_module->initialise) {
+ suspend_message(SUSPEND_MEMORY, SUSPEND_MEDIUM, 1,
+ "Initialising module %s.\n",
+ this_module->name);
+ if ((result = this_module->initialise(starting_cycle))) {
+ printk("%s didn't initialise okay.\n",
+ this_module->name);
+ return result;
+ }
+ }
+ }
+
+ return 0;
+}
+
+/*
+ * suspend_cleanup_modules
+ *
+ * Tell modules the work is done.
+ */
+void suspend_cleanup_modules(int finishing_cycle)
+{
+ struct suspend_module_ops *this_module;
+
+ list_for_each_entry(this_module, &suspend_modules, module_list) {
+ if (this_module->disabled)
+ continue;
+ if (this_module->cleanup) {
+ suspend_message(SUSPEND_MEMORY, SUSPEND_MEDIUM, 1,
+ "Cleaning up module %s.\n",
+ this_module->name);
+ this_module->cleanup(finishing_cycle);
+ }
+ }
+}
+
return len;
}
--
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]