aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/power/user.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/user.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/user.c')
-rw-r--r--kernel/power/user.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 1f24f30b951b..7f19afe01b48 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -151,10 +151,14 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
151 if (data->frozen) 151 if (data->frozen)
152 break; 152 break;
153 mutex_lock(&pm_mutex); 153 mutex_lock(&pm_mutex);
154 if (freeze_processes()) { 154 error = pm_notifier_call_chain(PM_HIBERNATION_PREPARE);
155 thaw_processes(); 155 if (!error) {
156 error = -EBUSY; 156 error = freeze_processes();
157 if (error)
158 thaw_processes();
157 } 159 }
160 if (error)
161 pm_notifier_call_chain(PM_POST_HIBERNATION);
158 mutex_unlock(&pm_mutex); 162 mutex_unlock(&pm_mutex);
159 if (!error) 163 if (!error)
160 data->frozen = 1; 164 data->frozen = 1;
@@ -165,6 +169,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
165 break; 169 break;
166 mutex_lock(&pm_mutex); 170 mutex_lock(&pm_mutex);
167 thaw_processes(); 171 thaw_processes();
172 pm_notifier_call_chain(PM_POST_HIBERNATION);
168 mutex_unlock(&pm_mutex); 173 mutex_unlock(&pm_mutex);
169 data->frozen = 0; 174 data->frozen = 0;
170 break; 175 break;