diff options
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r-- | kernel/power/main.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index 454434716f35..71aa0fd22007 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -59,6 +59,13 @@ static int suspend_prepare(suspend_state_t state) | |||
59 | 59 | ||
60 | pm_prepare_console(); | 60 | pm_prepare_console(); |
61 | 61 | ||
62 | disable_nonboot_cpus(); | ||
63 | |||
64 | if (num_online_cpus() != 1) { | ||
65 | error = -EPERM; | ||
66 | goto Enable_cpu; | ||
67 | } | ||
68 | |||
62 | if (freeze_processes()) { | 69 | if (freeze_processes()) { |
63 | error = -EAGAIN; | 70 | error = -EAGAIN; |
64 | goto Thaw; | 71 | goto Thaw; |
@@ -89,6 +96,8 @@ static int suspend_prepare(suspend_state_t state) | |||
89 | pm_ops->finish(state); | 96 | pm_ops->finish(state); |
90 | Thaw: | 97 | Thaw: |
91 | thaw_processes(); | 98 | thaw_processes(); |
99 | Enable_cpu: | ||
100 | enable_nonboot_cpus(); | ||
92 | pm_restore_console(); | 101 | pm_restore_console(); |
93 | return error; | 102 | return error; |
94 | } | 103 | } |
@@ -127,6 +136,7 @@ static void suspend_finish(suspend_state_t state) | |||
127 | if (pm_ops && pm_ops->finish) | 136 | if (pm_ops && pm_ops->finish) |
128 | pm_ops->finish(state); | 137 | pm_ops->finish(state); |
129 | thaw_processes(); | 138 | thaw_processes(); |
139 | enable_nonboot_cpus(); | ||
130 | pm_restore_console(); | 140 | pm_restore_console(); |
131 | } | 141 | } |
132 | 142 | ||
@@ -164,12 +174,6 @@ static int enter_state(suspend_state_t state) | |||
164 | goto Unlock; | 174 | goto Unlock; |
165 | } | 175 | } |
166 | 176 | ||
167 | /* Suspend is hard to get right on SMP. */ | ||
168 | if (num_online_cpus() != 1) { | ||
169 | error = -EPERM; | ||
170 | goto Unlock; | ||
171 | } | ||
172 | |||
173 | pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]); | 177 | pr_debug("PM: Preparing system for %s sleep\n", pm_states[state]); |
174 | if ((error = suspend_prepare(state))) | 178 | if ((error = suspend_prepare(state))) |
175 | goto Unlock; | 179 | goto Unlock; |