diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-24 22:38:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-05-24 22:38:25 -0400 |
commit | 93c32483808c5d82c9bd1eef2208854a6d1326db (patch) | |
tree | fd8190ca7ce4b210f4e9fff135041f5c02456682 | |
parent | d5a877e8dd409d8c702986d06485c374b705d340 (diff) | |
parent | 32bdfac5462d777f35b00838893c4f87baf23efe (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/suspend-2.6:
PM: Do not hold dpm_list_mtx while disabling/enabling nonboot CPUs
-rw-r--r-- | drivers/base/power/main.c | 4 | ||||
-rw-r--r-- | kernel/kexec.c | 2 | ||||
-rw-r--r-- | kernel/power/disk.c | 21 | ||||
-rw-r--r-- | kernel/power/main.c | 7 |
4 files changed, 8 insertions, 26 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 69b4ddb7de3b..3e4bc699bc0f 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -357,6 +357,7 @@ static void dpm_power_up(pm_message_t state) | |||
357 | { | 357 | { |
358 | struct device *dev; | 358 | struct device *dev; |
359 | 359 | ||
360 | mutex_lock(&dpm_list_mtx); | ||
360 | list_for_each_entry(dev, &dpm_list, power.entry) | 361 | list_for_each_entry(dev, &dpm_list, power.entry) |
361 | if (dev->power.status > DPM_OFF) { | 362 | if (dev->power.status > DPM_OFF) { |
362 | int error; | 363 | int error; |
@@ -366,6 +367,7 @@ static void dpm_power_up(pm_message_t state) | |||
366 | if (error) | 367 | if (error) |
367 | pm_dev_err(dev, state, " early", error); | 368 | pm_dev_err(dev, state, " early", error); |
368 | } | 369 | } |
370 | mutex_unlock(&dpm_list_mtx); | ||
369 | } | 371 | } |
370 | 372 | ||
371 | /** | 373 | /** |
@@ -614,6 +616,7 @@ int device_power_down(pm_message_t state) | |||
614 | int error = 0; | 616 | int error = 0; |
615 | 617 | ||
616 | suspend_device_irqs(); | 618 | suspend_device_irqs(); |
619 | mutex_lock(&dpm_list_mtx); | ||
617 | list_for_each_entry_reverse(dev, &dpm_list, power.entry) { | 620 | list_for_each_entry_reverse(dev, &dpm_list, power.entry) { |
618 | error = suspend_device_noirq(dev, state); | 621 | error = suspend_device_noirq(dev, state); |
619 | if (error) { | 622 | if (error) { |
@@ -622,6 +625,7 @@ int device_power_down(pm_message_t state) | |||
622 | } | 625 | } |
623 | dev->power.status = DPM_OFF_IRQ; | 626 | dev->power.status = DPM_OFF_IRQ; |
624 | } | 627 | } |
628 | mutex_unlock(&dpm_list_mtx); | ||
625 | if (error) | 629 | if (error) |
626 | device_power_up(resume_event(state)); | 630 | device_power_up(resume_event(state)); |
627 | return error; | 631 | return error; |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 5a758c6e4950..e4983770913b 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
@@ -1451,7 +1451,6 @@ int kernel_kexec(void) | |||
1451 | error = device_suspend(PMSG_FREEZE); | 1451 | error = device_suspend(PMSG_FREEZE); |
1452 | if (error) | 1452 | if (error) |
1453 | goto Resume_console; | 1453 | goto Resume_console; |
1454 | device_pm_lock(); | ||
1455 | /* At this point, device_suspend() has been called, | 1454 | /* At this point, device_suspend() has been called, |
1456 | * but *not* device_power_down(). We *must* | 1455 | * but *not* device_power_down(). We *must* |
1457 | * device_power_down() now. Otherwise, drivers for | 1456 | * device_power_down() now. Otherwise, drivers for |
@@ -1489,7 +1488,6 @@ int kernel_kexec(void) | |||
1489 | enable_nonboot_cpus(); | 1488 | enable_nonboot_cpus(); |
1490 | device_power_up(PMSG_RESTORE); | 1489 | device_power_up(PMSG_RESTORE); |
1491 | Resume_devices: | 1490 | Resume_devices: |
1492 | device_pm_unlock(); | ||
1493 | device_resume(PMSG_RESTORE); | 1491 | device_resume(PMSG_RESTORE); |
1494 | Resume_console: | 1492 | Resume_console: |
1495 | resume_console(); | 1493 | resume_console(); |
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index b0dc9e7a0d17..5cb080e7eebd 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
@@ -215,8 +215,6 @@ static int create_image(int platform_mode) | |||
215 | if (error) | 215 | if (error) |
216 | return error; | 216 | return error; |
217 | 217 | ||
218 | device_pm_lock(); | ||
219 | |||
220 | /* At this point, device_suspend() has been called, but *not* | 218 | /* At this point, device_suspend() has been called, but *not* |
221 | * device_power_down(). We *must* call device_power_down() now. | 219 | * device_power_down(). We *must* call device_power_down() now. |
222 | * Otherwise, drivers for some devices (e.g. interrupt controllers) | 220 | * Otherwise, drivers for some devices (e.g. interrupt controllers) |
@@ -227,7 +225,7 @@ static int create_image(int platform_mode) | |||
227 | if (error) { | 225 | if (error) { |
228 | printk(KERN_ERR "PM: Some devices failed to power down, " | 226 | printk(KERN_ERR "PM: Some devices failed to power down, " |
229 | "aborting hibernation\n"); | 227 | "aborting hibernation\n"); |
230 | goto Unlock; | 228 | return error; |
231 | } | 229 | } |
232 | 230 | ||
233 | error = platform_pre_snapshot(platform_mode); | 231 | error = platform_pre_snapshot(platform_mode); |
@@ -280,9 +278,6 @@ static int create_image(int platform_mode) | |||
280 | device_power_up(in_suspend ? | 278 | device_power_up(in_suspend ? |
281 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); | 279 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); |
282 | 280 | ||
283 | Unlock: | ||
284 | device_pm_unlock(); | ||
285 | |||
286 | return error; | 281 | return error; |
287 | } | 282 | } |
288 | 283 | ||
@@ -344,13 +339,11 @@ static int resume_target_kernel(bool platform_mode) | |||
344 | { | 339 | { |
345 | int error; | 340 | int error; |
346 | 341 | ||
347 | device_pm_lock(); | ||
348 | |||
349 | error = device_power_down(PMSG_QUIESCE); | 342 | error = device_power_down(PMSG_QUIESCE); |
350 | if (error) { | 343 | if (error) { |
351 | printk(KERN_ERR "PM: Some devices failed to power down, " | 344 | printk(KERN_ERR "PM: Some devices failed to power down, " |
352 | "aborting resume\n"); | 345 | "aborting resume\n"); |
353 | goto Unlock; | 346 | return error; |
354 | } | 347 | } |
355 | 348 | ||
356 | error = platform_pre_restore(platform_mode); | 349 | error = platform_pre_restore(platform_mode); |
@@ -403,9 +396,6 @@ static int resume_target_kernel(bool platform_mode) | |||
403 | 396 | ||
404 | device_power_up(PMSG_RECOVER); | 397 | device_power_up(PMSG_RECOVER); |
405 | 398 | ||
406 | Unlock: | ||
407 | device_pm_unlock(); | ||
408 | |||
409 | return error; | 399 | return error; |
410 | } | 400 | } |
411 | 401 | ||
@@ -464,11 +454,9 @@ int hibernation_platform_enter(void) | |||
464 | goto Resume_devices; | 454 | goto Resume_devices; |
465 | } | 455 | } |
466 | 456 | ||
467 | device_pm_lock(); | ||
468 | |||
469 | error = device_power_down(PMSG_HIBERNATE); | 457 | error = device_power_down(PMSG_HIBERNATE); |
470 | if (error) | 458 | if (error) |
471 | goto Unlock; | 459 | goto Resume_devices; |
472 | 460 | ||
473 | error = hibernation_ops->prepare(); | 461 | error = hibernation_ops->prepare(); |
474 | if (error) | 462 | if (error) |
@@ -493,9 +481,6 @@ int hibernation_platform_enter(void) | |||
493 | 481 | ||
494 | device_power_up(PMSG_RESTORE); | 482 | device_power_up(PMSG_RESTORE); |
495 | 483 | ||
496 | Unlock: | ||
497 | device_pm_unlock(); | ||
498 | |||
499 | Resume_devices: | 484 | Resume_devices: |
500 | entering_platform_hibernation = false; | 485 | entering_platform_hibernation = false; |
501 | device_resume(PMSG_RESTORE); | 486 | device_resume(PMSG_RESTORE); |
diff --git a/kernel/power/main.c b/kernel/power/main.c index f99ed6a75eac..868028280d13 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
@@ -289,12 +289,10 @@ static int suspend_enter(suspend_state_t state) | |||
289 | { | 289 | { |
290 | int error; | 290 | int error; |
291 | 291 | ||
292 | device_pm_lock(); | ||
293 | |||
294 | if (suspend_ops->prepare) { | 292 | if (suspend_ops->prepare) { |
295 | error = suspend_ops->prepare(); | 293 | error = suspend_ops->prepare(); |
296 | if (error) | 294 | if (error) |
297 | goto Done; | 295 | return error; |
298 | } | 296 | } |
299 | 297 | ||
300 | error = device_power_down(PMSG_SUSPEND); | 298 | error = device_power_down(PMSG_SUSPEND); |
@@ -343,9 +341,6 @@ static int suspend_enter(suspend_state_t state) | |||
343 | if (suspend_ops->finish) | 341 | if (suspend_ops->finish) |
344 | suspend_ops->finish(); | 342 | suspend_ops->finish(); |
345 | 343 | ||
346 | Done: | ||
347 | device_pm_unlock(); | ||
348 | |||
349 | return error; | 344 | return error; |
350 | } | 345 | } |
351 | 346 | ||