diff options
Diffstat (limited to 'kernel/power')
-rw-r--r-- | kernel/power/suspend.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index 1c41ba215419..b6762f43365d 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
@@ -126,12 +126,13 @@ void __attribute__ ((weak)) arch_suspend_enable_irqs(void) | |||
126 | } | 126 | } |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * suspend_enter - enter the desired system sleep state. | 129 | * suspend_enter - enter the desired system sleep state. |
130 | * @state: state to enter | 130 | * @state: State to enter |
131 | * @wakeup: Returns information that suspend should not be entered again. | ||
131 | * | 132 | * |
132 | * This function should be called after devices have been suspended. | 133 | * This function should be called after devices have been suspended. |
133 | */ | 134 | */ |
134 | static int suspend_enter(suspend_state_t state) | 135 | static int suspend_enter(suspend_state_t state, bool *wakeup) |
135 | { | 136 | { |
136 | int error; | 137 | int error; |
137 | 138 | ||
@@ -165,7 +166,8 @@ static int suspend_enter(suspend_state_t state) | |||
165 | 166 | ||
166 | error = syscore_suspend(); | 167 | error = syscore_suspend(); |
167 | if (!error) { | 168 | if (!error) { |
168 | if (!(suspend_test(TEST_CORE) || pm_wakeup_pending())) { | 169 | *wakeup = pm_wakeup_pending(); |
170 | if (!(suspend_test(TEST_CORE) || *wakeup)) { | ||
169 | error = suspend_ops->enter(state); | 171 | error = suspend_ops->enter(state); |
170 | events_check_enabled = false; | 172 | events_check_enabled = false; |
171 | } | 173 | } |
@@ -199,6 +201,7 @@ static int suspend_enter(suspend_state_t state) | |||
199 | int suspend_devices_and_enter(suspend_state_t state) | 201 | int suspend_devices_and_enter(suspend_state_t state) |
200 | { | 202 | { |
201 | int error; | 203 | int error; |
204 | bool wakeup = false; | ||
202 | 205 | ||
203 | if (!suspend_ops) | 206 | if (!suspend_ops) |
204 | return -ENOSYS; | 207 | return -ENOSYS; |
@@ -220,7 +223,10 @@ int suspend_devices_and_enter(suspend_state_t state) | |||
220 | if (suspend_test(TEST_DEVICES)) | 223 | if (suspend_test(TEST_DEVICES)) |
221 | goto Recover_platform; | 224 | goto Recover_platform; |
222 | 225 | ||
223 | error = suspend_enter(state); | 226 | do { |
227 | error = suspend_enter(state, &wakeup); | ||
228 | } while (!error && !wakeup | ||
229 | && suspend_ops->suspend_again && suspend_ops->suspend_again()); | ||
224 | 230 | ||
225 | Resume_devices: | 231 | Resume_devices: |
226 | suspend_test_start(); | 232 | suspend_test_start(); |