lkml.org 
[lkml]   [2006]   [Feb]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[ 04/10] [Suspend2] Module initialise/cleanup.
Date

Routines to tell modules that we're about to do some work, and conversely,
have finished our labours for the moment. We allow them to do some actions
only if we're starting/finishing a cycle by passing a flag to indicate
that.

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

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 f7e9ab0..eee5678 100644
--- a/kernel/power/modules.c
+++ b/kernel/power/modules.c
@@ -116,3 +116,52 @@ void suspend_move_module_tail(struct sus
if ((num_filters + num_writers + num_ui) > 1)
list_move_tail(&module->module_list, &suspend_modules);
}
+
+/*
+ * suspend2_initialise_modules
+ *
+ * Get ready to do some work!
+ */
+int suspend2_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;
+}
+
+/*
+ * suspend2_cleanup_modules
+ *
+ * Tell modules the work is done.
+ */
+void suspend2_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);
+ }
+ }
+}
--
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-02-01 12:44    [W:0.684 / U:3.292 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site