Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256916
b: refs/heads/master
c: 3b5fe85
h: refs/heads/master
v: v3
  • Loading branch information
MyungJoo Ham authored and Rafael J. Wysocki committed Jul 15, 2011
1 parent c33b202 commit 03a447b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 99f381d3549432a250fe846a2a82d61a032804b0
refs/heads/master: 3b5fe85252326217cd96f24a7bda4460d8f71bee
8 changes: 8 additions & 0 deletions trunk/include/linux/suspend.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ typedef int __bitwise suspend_state_t;
* @enter() and @wake(), even if any of them fails. It is executed after
* a failing @prepare.
*
* @suspend_again: Returns whether the system should suspend again (true) or
* not (false). If the platform wants to poll sensors or execute some
* code during suspended without invoking userspace and most of devices,
* suspend_again callback is the place assuming that periodic-wakeup or
* alarm-wakeup is already setup. This allows to execute some codes while
* being kept suspended in the view of userland and devices.
*
* @end: Called by the PM core right after resuming devices, to indicate to
* the platform that the system has returned to the working state or
* the transition to the sleep state has been aborted.
Expand All @@ -113,6 +120,7 @@ struct platform_suspend_ops {
int (*enter)(suspend_state_t state);
void (*wake)(void);
void (*finish)(void);
bool (*suspend_again)(void);
void (*end)(void);
void (*recover)(void);
};
Expand Down
18 changes: 12 additions & 6 deletions trunk/kernel/power/suspend.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,13 @@ void __attribute__ ((weak)) arch_suspend_enable_irqs(void)
}

/**
* suspend_enter - enter the desired system sleep state.
* @state: state to enter
* suspend_enter - enter the desired system sleep state.
* @state: State to enter
* @wakeup: Returns information that suspend should not be entered again.
*
* This function should be called after devices have been suspended.
* This function should be called after devices have been suspended.
*/
static int suspend_enter(suspend_state_t state)
static int suspend_enter(suspend_state_t state, bool *wakeup)
{
int error;

Expand Down Expand Up @@ -165,7 +166,8 @@ static int suspend_enter(suspend_state_t state)

error = syscore_suspend();
if (!error) {
if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) {
*wakeup = pm_wakeup_pending();
if (!(suspend_test(TEST_CORE) || *wakeup)) {
error = suspend_ops->enter(state);
events_check_enabled = false;
}
Expand Down Expand Up @@ -199,6 +201,7 @@ static int suspend_enter(suspend_state_t state)
int suspend_devices_and_enter(suspend_state_t state)
{
int error;
bool wakeup = false;

if (!suspend_ops)
return -ENOSYS;
Expand All @@ -220,7 +223,10 @@ int suspend_devices_and_enter(suspend_state_t state)
if (suspend_test(TEST_DEVICES))
goto Recover_platform;

error = suspend_enter(state);
do {
error = suspend_enter(state, &wakeup);
} while (!error && !wakeup
&& suspend_ops->suspend_again && suspend_ops->suspend_again());

Resume_devices:
suspend_test_start();
Expand Down

0 comments on commit 03a447b

Please sign in to comment.