mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nigel Cunningham <nigel@suspend2.net>
To: linux-kernel@vger.kernel.org
Subject: [Suspend2][ 08/11] [Suspend2] Initialise and cleanup routines for suspend2 modules.
Date: Tue, 27 Jun 2006 02:53:28 +1000	[thread overview]
Message-ID: <20060626165327.10957.45861.stgit@nigel.suspend2.net> (raw)
In-Reply-To: <20060626165301.10957.62592.stgit@nigel.suspend2.net>

Routines to iterate through the list of suspend2 modules, calling their
initialisation and cleanup routines.

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 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

  parent reply	other threads:[~2006-06-26 16:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-06-26 16:53 [Suspend2][ 00/11 Module support Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 01/11] [Suspend2] Modules.c header Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 02/11] [Suspend2] Get header storage needed for module data Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 03/11] [Suspend2] Get memory needed for Suspend2 modules Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 04/11] [Suspend2] Find a suspend2 module given its name Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 05/11] [Suspend2] Get debugging info from modules Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 06/11] [Suspend2] Register and unregister suspend2 modules Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 07/11] [Suspend2] Move a suspend2 module to the tail of its list Nigel Cunningham
2006-06-26 16:53 ` Nigel Cunningham [this message]
2006-06-26 16:53 ` [Suspend2][ 09/11] [Suspend2] Get next suspend2 module in the pipeline Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 10/11] [Suspend2] Get and put references to Suspend2 modules Nigel Cunningham
2006-06-26 16:53 ` [Suspend2][ 11/11] [Suspend2] Header file for " Nigel Cunningham
2006-06-26 21:15 ` [Suspend2][ 00/11 Module support Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060626165327.10957.45861.stgit@nigel.suspend2.net \
    --to=nigel@suspend2.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®