1
0

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>
This commit is contained in:
Rafael J. Wysocki
2007-07-19 01:47:36 -07:00
committed by Linus Torvalds
parent c2cf7d87d8
commit b10d911749
7 changed files with 138 additions and 12 deletions

View File

@@ -23,6 +23,8 @@
#include "power.h"
BLOCKING_NOTIFIER_HEAD(pm_chain_head);
/*This is just an arbitrary number */
#define FREE_PAGE_NUMBER (100)
@@ -78,6 +80,10 @@ static int suspend_prepare(suspend_state_t state)
if (!pm_ops || !pm_ops->enter)
return -EPERM;
error = pm_notifier_call_chain(PM_SUSPEND_PREPARE);
if (error)
goto Finish;
pm_prepare_console();
if (freeze_processes()) {
@@ -125,6 +131,8 @@ static int suspend_prepare(suspend_state_t state)
Thaw:
thaw_processes();
pm_restore_console();
Finish:
pm_notifier_call_chain(PM_POST_SUSPEND);
return error;
}
@@ -176,6 +184,7 @@ static void suspend_finish(suspend_state_t state)
resume_console();
thaw_processes();
pm_restore_console();
pm_notifier_call_chain(PM_POST_SUSPEND);
}