Add a routine to initialise modules in preparation for reading or writing a
portion of the image proper (not used for the header).
Signed-off-by: Nigel Cunningham <[email protected]>
kernel/power/io.c | 45 +++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 45 insertions(+), 0 deletions(-)
diff --git a/kernel/power/io.c b/kernel/power/io.c
index b3a997f..401789d 100644
--- a/kernel/power/io.c
+++ b/kernel/power/io.c
@@ -161,3 +161,48 @@ static void fill_suspend_header(struct s
suspend_io_time[i/2][i%2];
}
+/*
+ * rw_init_modules
+ *
+ * Iterate over modules, preparing the ones that will be used to read or write
+ * data.
+ */
+static int rw_init_modules(int rw, int which)
+{
+ struct suspend_module_ops *this_module;
+ /* Initialise page transformers */
+ list_for_each_entry(this_module, &suspend_filters, type_list) {
+ if (this_module->disabled)
+ continue;
+ if (this_module->rw_init &&
+ this_module->rw_init(rw, which)) {
+ abort_suspend("Failed to initialise the %s filter.",
+ this_module->name);
+ return 1;
+ }
+ }
+
+ /* Initialise writer */
+ if (suspend_active_writer->rw_init(rw, which)) {
+ abort_suspend("Failed to initialise the writer.");
+ if (!rw)
+ suspend_active_writer->invalidate_image();
+ return 1;
+ }
+
+ /* Initialise other modules */
+ list_for_each_entry(this_module, &suspend_modules, module_list) {
+ if (this_module->disabled)
+ continue;
+ if ((this_module->type == FILTER_MODULE) ||
+ (this_module->type == WRITER_MODULE))
+ continue;
+ if (this_module->rw_init && this_module->rw_init(rw, which)) {
+ set_result_state(SUSPEND_ABORTED);
+ return 1;
+ }
+ }
+
+ 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 [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]