diff options
Diffstat (limited to 'kernel/power/main.c')
-rw-r--r-- | kernel/power/main.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/kernel/power/main.c b/kernel/power/main.c index f172f41858bb..868028280d13 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -289,22 +289,26 @@ static int suspend_enter(suspend_state_t state) | |||
289 | { | 289 | { |
290 | int error; | 290 | int error; |
291 | 291 | ||
292 | device_pm_lock(); | 292 | if (suspend_ops->prepare) { |
293 | error = suspend_ops->prepare(); | ||
294 | if (error) | ||
295 | return error; | ||
296 | } | ||
293 | 297 | ||
294 | error = device_power_down(PMSG_SUSPEND); | 298 | error = device_power_down(PMSG_SUSPEND); |
295 | if (error) { | 299 | if (error) { |
296 | printk(KERN_ERR "PM: Some devices failed to power down\n"); | 300 | printk(KERN_ERR "PM: Some devices failed to power down\n"); |
297 | goto Done; | 301 | goto Platfrom_finish; |
298 | } | 302 | } |
299 | 303 | ||
300 | if (suspend_ops->prepare) { | 304 | if (suspend_ops->prepare_late) { |
301 | error = suspend_ops->prepare(); | 305 | error = suspend_ops->prepare_late(); |
302 | if (error) | 306 | if (error) |
303 | goto Power_up_devices; | 307 | goto Power_up_devices; |
304 | } | 308 | } |
305 | 309 | ||
306 | if (suspend_test(TEST_PLATFORM)) | 310 | if (suspend_test(TEST_PLATFORM)) |
307 | goto Platfrom_finish; | 311 | goto Platform_wake; |
308 | 312 | ||
309 | error = disable_nonboot_cpus(); | 313 | error = disable_nonboot_cpus(); |
310 | if (error || suspend_test(TEST_CPUS)) | 314 | if (error || suspend_test(TEST_CPUS)) |
@@ -326,15 +330,16 @@ static int suspend_enter(suspend_state_t state) | |||
326 | Enable_cpus: | 330 | Enable_cpus: |
327 | enable_nonboot_cpus(); | 331 | enable_nonboot_cpus(); |
328 | 332 | ||
329 | Platfrom_finish: | 333 | Platform_wake: |
330 | if (suspend_ops->finish) | 334 | if (suspend_ops->wake) |
331 | suspend_ops->finish(); | 335 | suspend_ops->wake(); |
332 | 336 | ||
333 | Power_up_devices: | 337 | Power_up_devices: |
334 | device_power_up(PMSG_RESUME); | 338 | device_power_up(PMSG_RESUME); |
335 | 339 | ||
336 | Done: | 340 | Platfrom_finish: |
337 | device_pm_unlock(); | 341 | if (suspend_ops->finish) |
342 | suspend_ops->finish(); | ||
338 | 343 | ||
339 | return error; | 344 | return error; |
340 | } | 345 | } |