aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/main.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2007-07-19 04:47:36 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-19 13:04:42 -0400
commitb10d911749d37dccfa5873d2088aea3f074b9e45 (patch)
tree56bd0ccb2861d7ae562d4e48a737727628358b42 /kernel/power/main.c
parentc2cf7d87d804c66e063829d5ca739053e901dc15 (diff)
PM: introduce hibernation and suspend notifiers
Make it possible to register hibernation and suspend notifiers, so that subsystems can perform hibernation-related or suspend-related operations that should not be carried out by device drivers' .suspend() and .resume() routines. [akpm@linux-foundation.org: build fixes] [akpm@linux-foundation.org: cleanups] Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Cc: Nigel Cunningham <nigel@nigel.suspend2.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r--kernel/power/main.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c
index fc45ed22620f..4d26ad394fb3 100644
--- a/kernel/power/main.c
+++ b/kernel/power/main.c
@@ -23,6 +23,8 @@
23 23
24#include "power.h" 24#include "power.h"
25 25
26BLOCKING_NOTIFIER_HEAD(pm_chain_head);
27
26/*This is just an arbitrary number */ 28/*This is just an arbitrary number */
27#define FREE_PAGE_NUMBER (100) 29#define FREE_PAGE_NUMBER (100)
28 30
@@ -78,6 +80,10 @@ static int suspend_prepare(suspend_state_t state)
78 if (!pm_ops || !pm_ops->enter) 80 if (!pm_ops || !pm_ops->enter)
79 return -EPERM; 81 return -EPERM;
80 82
83 error = pm_notifier_call_chain(PM_SUSPEND_PREPARE);
84 if (error)
85 goto Finish;
86
81 pm_prepare_console(); 87 pm_prepare_console();
82 88
83 if (freeze_processes()) { 89 if (freeze_processes()) {
@@ -125,6 +131,8 @@ static int suspend_prepare(suspend_state_t state)
125 Thaw: 131 Thaw:
126 thaw_processes(); 132 thaw_processes();
127 pm_restore_console(); 133 pm_restore_console();
134 Finish:
135 pm_notifier_call_chain(PM_POST_SUSPEND);
128 return error; 136 return error;
129} 137}
130 138
@@ -176,6 +184,7 @@ static void suspend_finish(suspend_state_t state)
176 resume_console(); 184 resume_console();
177 thaw_processes(); 185 thaw_processes();
178 pm_restore_console(); 186 pm_restore_console();
187 pm_notifier_call_chain(PM_POST_SUSPEND);
179} 188}
180 189
181 190