diff options
| -rw-r--r-- | arch/x86/kernel/apm_32.c | 14 | ||||
| -rw-r--r-- | drivers/base/power/main.c | 80 | ||||
| -rw-r--r-- | drivers/xen/manage.c | 16 | ||||
| -rw-r--r-- | include/linux/pm.h | 11 | ||||
| -rw-r--r-- | kernel/kexec.c | 14 | ||||
| -rw-r--r-- | kernel/power/disk.c | 30 | ||||
| -rw-r--r-- | kernel/power/main.c | 8 |
7 files changed, 80 insertions, 93 deletions
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c index 31ae547da159..79302e9a33a4 100644 --- a/arch/x86/kernel/apm_32.c +++ b/arch/x86/kernel/apm_32.c | |||
| @@ -1233,9 +1233,9 @@ static int suspend(int vetoable) | |||
| 1233 | int err; | 1233 | int err; |
| 1234 | struct apm_user *as; | 1234 | struct apm_user *as; |
| 1235 | 1235 | ||
| 1236 | device_suspend(PMSG_SUSPEND); | 1236 | dpm_suspend_start(PMSG_SUSPEND); |
| 1237 | 1237 | ||
| 1238 | device_suspend_noirq(PMSG_SUSPEND); | 1238 | dpm_suspend_noirq(PMSG_SUSPEND); |
| 1239 | 1239 | ||
| 1240 | local_irq_disable(); | 1240 | local_irq_disable(); |
| 1241 | sysdev_suspend(PMSG_SUSPEND); | 1241 | sysdev_suspend(PMSG_SUSPEND); |
| @@ -1259,9 +1259,9 @@ static int suspend(int vetoable) | |||
| 1259 | sysdev_resume(); | 1259 | sysdev_resume(); |
| 1260 | local_irq_enable(); | 1260 | local_irq_enable(); |
| 1261 | 1261 | ||
| 1262 | device_resume_noirq(PMSG_RESUME); | 1262 | dpm_resume_noirq(PMSG_RESUME); |
| 1263 | 1263 | ||
| 1264 | device_resume(PMSG_RESUME); | 1264 | dpm_resume_end(PMSG_RESUME); |
| 1265 | queue_event(APM_NORMAL_RESUME, NULL); | 1265 | queue_event(APM_NORMAL_RESUME, NULL); |
| 1266 | spin_lock(&user_list_lock); | 1266 | spin_lock(&user_list_lock); |
| 1267 | for (as = user_list; as != NULL; as = as->next) { | 1267 | for (as = user_list; as != NULL; as = as->next) { |
| @@ -1277,7 +1277,7 @@ static void standby(void) | |||
| 1277 | { | 1277 | { |
| 1278 | int err; | 1278 | int err; |
| 1279 | 1279 | ||
| 1280 | device_suspend_noirq(PMSG_SUSPEND); | 1280 | dpm_suspend_noirq(PMSG_SUSPEND); |
| 1281 | 1281 | ||
| 1282 | local_irq_disable(); | 1282 | local_irq_disable(); |
| 1283 | sysdev_suspend(PMSG_SUSPEND); | 1283 | sysdev_suspend(PMSG_SUSPEND); |
| @@ -1291,7 +1291,7 @@ static void standby(void) | |||
| 1291 | sysdev_resume(); | 1291 | sysdev_resume(); |
| 1292 | local_irq_enable(); | 1292 | local_irq_enable(); |
| 1293 | 1293 | ||
| 1294 | device_resume_noirq(PMSG_RESUME); | 1294 | dpm_resume_noirq(PMSG_RESUME); |
| 1295 | } | 1295 | } |
| 1296 | 1296 | ||
| 1297 | static apm_event_t get_event(void) | 1297 | static apm_event_t get_event(void) |
| @@ -1376,7 +1376,7 @@ static void check_events(void) | |||
| 1376 | ignore_bounce = 1; | 1376 | ignore_bounce = 1; |
| 1377 | if ((event != APM_NORMAL_RESUME) | 1377 | if ((event != APM_NORMAL_RESUME) |
| 1378 | || (ignore_normal_resume == 0)) { | 1378 | || (ignore_normal_resume == 0)) { |
| 1379 | device_resume(PMSG_RESUME); | 1379 | dpm_resume_end(PMSG_RESUME); |
| 1380 | queue_event(event, NULL); | 1380 | queue_event(event, NULL); |
| 1381 | } | 1381 | } |
| 1382 | ignore_normal_resume = 0; | 1382 | ignore_normal_resume = 0; |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index c5a35bc9d63b..1f3d82260db4 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -315,13 +315,13 @@ static void pm_dev_err(struct device *dev, pm_message_t state, char *info, | |||
| 315 | /*------------------------- Resume routines -------------------------*/ | 315 | /*------------------------- Resume routines -------------------------*/ |
| 316 | 316 | ||
| 317 | /** | 317 | /** |
| 318 | * __device_resume_noirq - Power on one device (early resume). | 318 | * device_resume_noirq - Power on one device (early resume). |
| 319 | * @dev: Device. | 319 | * @dev: Device. |
| 320 | * @state: PM transition of the system being carried out. | 320 | * @state: PM transition of the system being carried out. |
| 321 | * | 321 | * |
| 322 | * Must be called with interrupts disabled. | 322 | * Must be called with interrupts disabled. |
| 323 | */ | 323 | */ |
| 324 | static int __device_resume_noirq(struct device *dev, pm_message_t state) | 324 | static int device_resume_noirq(struct device *dev, pm_message_t state) |
| 325 | { | 325 | { |
| 326 | int error = 0; | 326 | int error = 0; |
| 327 | 327 | ||
| @@ -344,16 +344,16 @@ static int __device_resume_noirq(struct device *dev, pm_message_t state) | |||
| 344 | } | 344 | } |
| 345 | 345 | ||
| 346 | /** | 346 | /** |
| 347 | * dpm_power_up - Power on all regular (non-sysdev) devices. | 347 | * dpm_resume_noirq - Power on all regular (non-sysdev) devices. |
| 348 | * @state: PM transition of the system being carried out. | 348 | * @state: PM transition of the system being carried out. |
| 349 | * | 349 | * |
| 350 | * Execute the appropriate "noirq resume" callback for all devices marked | 350 | * Call the "noirq" resume handlers for all devices marked as |
| 351 | * as DPM_OFF_IRQ. | 351 | * DPM_OFF_IRQ and enable device drivers to receive interrupts. |
| 352 | * | 352 | * |
| 353 | * Must be called under dpm_list_mtx. Device drivers should not receive | 353 | * Must be called under dpm_list_mtx. Device drivers should not receive |
| 354 | * interrupts while it's being executed. | 354 | * interrupts while it's being executed. |
| 355 | */ | 355 | */ |
| 356 | static void dpm_power_up(pm_message_t state) | 356 | void dpm_resume_noirq(pm_message_t state) |
| 357 | { | 357 | { |
| 358 | struct device *dev; | 358 | struct device *dev; |
| 359 | 359 | ||
| @@ -363,33 +363,21 @@ static void dpm_power_up(pm_message_t state) | |||
| 363 | int error; | 363 | int error; |
| 364 | 364 | ||
| 365 | dev->power.status = DPM_OFF; | 365 | dev->power.status = DPM_OFF; |
| 366 | error = __device_resume_noirq(dev, state); | 366 | error = device_resume_noirq(dev, state); |
| 367 | if (error) | 367 | if (error) |
| 368 | pm_dev_err(dev, state, " early", error); | 368 | pm_dev_err(dev, state, " early", error); |
| 369 | } | 369 | } |
| 370 | mutex_unlock(&dpm_list_mtx); | 370 | mutex_unlock(&dpm_list_mtx); |
| 371 | } | ||
| 372 | |||
| 373 | /** | ||
| 374 | * device_resume_noirq - Turn on all devices that need special attention. | ||
| 375 | * @state: PM transition of the system being carried out. | ||
| 376 | * | ||
| 377 | * Call the "early" resume handlers and enable device drivers to receive | ||
| 378 | * interrupts. | ||
| 379 | */ | ||
| 380 | void device_resume_noirq(pm_message_t state) | ||
| 381 | { | ||
| 382 | dpm_power_up(state); | ||
| 383 | resume_device_irqs(); | 371 | resume_device_irqs(); |
| 384 | } | 372 | } |
| 385 | EXPORT_SYMBOL_GPL(device_resume_noirq); | 373 | EXPORT_SYMBOL_GPL(dpm_resume_noirq); |
| 386 | 374 | ||
| 387 | /** | 375 | /** |
| 388 | * resume_device - Restore state for one device. | 376 | * device_resume - Restore state for one device. |
| 389 | * @dev: Device. | 377 | * @dev: Device. |
| 390 | * @state: PM transition of the system being carried out. | 378 | * @state: PM transition of the system being carried out. |
| 391 | */ | 379 | */ |
| 392 | static int resume_device(struct device *dev, pm_message_t state) | 380 | static int device_resume(struct device *dev, pm_message_t state) |
| 393 | { | 381 | { |
| 394 | int error = 0; | 382 | int error = 0; |
| 395 | 383 | ||
| @@ -462,7 +450,7 @@ static void dpm_resume(pm_message_t state) | |||
| 462 | dev->power.status = DPM_RESUMING; | 450 | dev->power.status = DPM_RESUMING; |
| 463 | mutex_unlock(&dpm_list_mtx); | 451 | mutex_unlock(&dpm_list_mtx); |
| 464 | 452 | ||
| 465 | error = resume_device(dev, state); | 453 | error = device_resume(dev, state); |
| 466 | 454 | ||
| 467 | mutex_lock(&dpm_list_mtx); | 455 | mutex_lock(&dpm_list_mtx); |
| 468 | if (error) | 456 | if (error) |
| @@ -480,11 +468,11 @@ static void dpm_resume(pm_message_t state) | |||
| 480 | } | 468 | } |
| 481 | 469 | ||
| 482 | /** | 470 | /** |
| 483 | * complete_device - Complete a PM transition for given device | 471 | * device_complete - Complete a PM transition for given device |
| 484 | * @dev: Device. | 472 | * @dev: Device. |
| 485 | * @state: PM transition of the system being carried out. | 473 | * @state: PM transition of the system being carried out. |
| 486 | */ | 474 | */ |
| 487 | static void complete_device(struct device *dev, pm_message_t state) | 475 | static void device_complete(struct device *dev, pm_message_t state) |
| 488 | { | 476 | { |
| 489 | down(&dev->sem); | 477 | down(&dev->sem); |
| 490 | 478 | ||
| @@ -527,7 +515,7 @@ static void dpm_complete(pm_message_t state) | |||
| 527 | dev->power.status = DPM_ON; | 515 | dev->power.status = DPM_ON; |
| 528 | mutex_unlock(&dpm_list_mtx); | 516 | mutex_unlock(&dpm_list_mtx); |
| 529 | 517 | ||
| 530 | complete_device(dev, state); | 518 | device_complete(dev, state); |
| 531 | 519 | ||
| 532 | mutex_lock(&dpm_list_mtx); | 520 | mutex_lock(&dpm_list_mtx); |
| 533 | } | 521 | } |
| @@ -540,19 +528,19 @@ static void dpm_complete(pm_message_t state) | |||
| 540 | } | 528 | } |
| 541 | 529 | ||
| 542 | /** | 530 | /** |
| 543 | * device_resume - Restore state of each device in system. | 531 | * dpm_resume_end - Restore state of each device in system. |
| 544 | * @state: PM transition of the system being carried out. | 532 | * @state: PM transition of the system being carried out. |
| 545 | * | 533 | * |
| 546 | * Resume all the devices, unlock them all, and allow new | 534 | * Resume all the devices, unlock them all, and allow new |
| 547 | * devices to be registered once again. | 535 | * devices to be registered once again. |
| 548 | */ | 536 | */ |
| 549 | void device_resume(pm_message_t state) | 537 | void dpm_resume_end(pm_message_t state) |
| 550 | { | 538 | { |
| 551 | might_sleep(); | 539 | might_sleep(); |
| 552 | dpm_resume(state); | 540 | dpm_resume(state); |
| 553 | dpm_complete(state); | 541 | dpm_complete(state); |
| 554 | } | 542 | } |
| 555 | EXPORT_SYMBOL_GPL(device_resume); | 543 | EXPORT_SYMBOL_GPL(dpm_resume_end); |
| 556 | 544 | ||
| 557 | 545 | ||
| 558 | /*------------------------- Suspend routines -------------------------*/ | 546 | /*------------------------- Suspend routines -------------------------*/ |
| @@ -577,13 +565,13 @@ static pm_message_t resume_event(pm_message_t sleep_state) | |||
| 577 | } | 565 | } |
| 578 | 566 | ||
| 579 | /** | 567 | /** |
| 580 | * __device_suspend_noirq - Shut down one device (late suspend). | 568 | * device_suspend_noirq - Shut down one device (late suspend). |
| 581 | * @dev: Device. | 569 | * @dev: Device. |
| 582 | * @state: PM transition of the system being carried out. | 570 | * @state: PM transition of the system being carried out. |
| 583 | * | 571 | * |
| 584 | * This is called with interrupts off and only a single CPU running. | 572 | * This is called with interrupts off and only a single CPU running. |
| 585 | */ | 573 | */ |
| 586 | static int __device_suspend_noirq(struct device *dev, pm_message_t state) | 574 | static int device_suspend_noirq(struct device *dev, pm_message_t state) |
| 587 | { | 575 | { |
| 588 | int error = 0; | 576 | int error = 0; |
| 589 | 577 | ||
| @@ -602,15 +590,15 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state) | |||
| 602 | } | 590 | } |
| 603 | 591 | ||
| 604 | /** | 592 | /** |
| 605 | * device_suspend_noirq - Shut down special devices. | 593 | * dpm_suspend_noirq - Power down all regular (non-sysdev) devices. |
| 606 | * @state: PM transition of the system being carried out. | 594 | * @state: PM transition of the system being carried out. |
| 607 | * | 595 | * |
| 608 | * Prevent device drivers from receiving interrupts and call the "late" | 596 | * Prevent device drivers from receiving interrupts and call the "noirq" |
| 609 | * suspend handlers. | 597 | * suspend handlers. |
| 610 | * | 598 | * |
| 611 | * Must be called under dpm_list_mtx. | 599 | * Must be called under dpm_list_mtx. |
| 612 | */ | 600 | */ |
| 613 | int device_suspend_noirq(pm_message_t state) | 601 | int dpm_suspend_noirq(pm_message_t state) |
| 614 | { | 602 | { |
| 615 | struct device *dev; | 603 | struct device *dev; |
| 616 | int error = 0; | 604 | int error = 0; |
| @@ -618,7 +606,7 @@ int device_suspend_noirq(pm_message_t state) | |||
| 618 | suspend_device_irqs(); | 606 | suspend_device_irqs(); |
| 619 | mutex_lock(&dpm_list_mtx); | 607 | mutex_lock(&dpm_list_mtx); |
| 620 | list_for_each_entry_reverse(dev, &dpm_list, power.entry) { | 608 | list_for_each_entry_reverse(dev, &dpm_list, power.entry) { |
| 621 | error = __device_suspend_noirq(dev, state); | 609 | error = device_suspend_noirq(dev, state); |
| 622 | if (error) { | 610 | if (error) { |
| 623 | pm_dev_err(dev, state, " late", error); | 611 | pm_dev_err(dev, state, " late", error); |
| 624 | break; | 612 | break; |
| @@ -627,17 +615,17 @@ int device_suspend_noirq(pm_message_t state) | |||
| 627 | } | 615 | } |
| 628 | mutex_unlock(&dpm_list_mtx); | 616 | mutex_unlock(&dpm_list_mtx); |
| 629 | if (error) | 617 | if (error) |
| 630 | device_resume_noirq(resume_event(state)); | 618 | dpm_resume_noirq(resume_event(state)); |
| 631 | return error; | 619 | return error; |
| 632 | } | 620 | } |
| 633 | EXPORT_SYMBOL_GPL(device_suspend_noirq); | 621 | EXPORT_SYMBOL_GPL(dpm_suspend_noirq); |
| 634 | 622 | ||
| 635 | /** | 623 | /** |
| 636 | * suspend_device - Save state of one device. | 624 | * device_suspend - Save state of one device. |
| 637 | * @dev: Device. | 625 | * @dev: Device. |
| 638 | * @state: PM transition of the system being carried out. | 626 | * @state: PM transition of the system being carried out. |
| 639 | */ | 627 | */ |
| 640 | static int suspend_device(struct device *dev, pm_message_t state) | 628 | static int device_suspend(struct device *dev, pm_message_t state) |
| 641 | { | 629 | { |
| 642 | int error = 0; | 630 | int error = 0; |
| 643 | 631 | ||
| @@ -704,7 +692,7 @@ static int dpm_suspend(pm_message_t state) | |||
| 704 | get_device(dev); | 692 | get_device(dev); |
| 705 | mutex_unlock(&dpm_list_mtx); | 693 | mutex_unlock(&dpm_list_mtx); |
| 706 | 694 | ||
| 707 | error = suspend_device(dev, state); | 695 | error = device_suspend(dev, state); |
| 708 | 696 | ||
| 709 | mutex_lock(&dpm_list_mtx); | 697 | mutex_lock(&dpm_list_mtx); |
| 710 | if (error) { | 698 | if (error) { |
| @@ -723,11 +711,11 @@ static int dpm_suspend(pm_message_t state) | |||
| 723 | } | 711 | } |
| 724 | 712 | ||
| 725 | /** | 713 | /** |
| 726 | * prepare_device - Execute the ->prepare() callback(s) for given device. | 714 | * device_prepare - Execute the ->prepare() callback(s) for given device. |
| 727 | * @dev: Device. | 715 | * @dev: Device. |
| 728 | * @state: PM transition of the system being carried out. | 716 | * @state: PM transition of the system being carried out. |
| 729 | */ | 717 | */ |
| 730 | static int prepare_device(struct device *dev, pm_message_t state) | 718 | static int device_prepare(struct device *dev, pm_message_t state) |
| 731 | { | 719 | { |
| 732 | int error = 0; | 720 | int error = 0; |
| 733 | 721 | ||
| @@ -781,7 +769,7 @@ static int dpm_prepare(pm_message_t state) | |||
| 781 | dev->power.status = DPM_PREPARING; | 769 | dev->power.status = DPM_PREPARING; |
| 782 | mutex_unlock(&dpm_list_mtx); | 770 | mutex_unlock(&dpm_list_mtx); |
| 783 | 771 | ||
| 784 | error = prepare_device(dev, state); | 772 | error = device_prepare(dev, state); |
| 785 | 773 | ||
| 786 | mutex_lock(&dpm_list_mtx); | 774 | mutex_lock(&dpm_list_mtx); |
| 787 | if (error) { | 775 | if (error) { |
| @@ -807,12 +795,12 @@ static int dpm_prepare(pm_message_t state) | |||
| 807 | } | 795 | } |
| 808 | 796 | ||
| 809 | /** | 797 | /** |
| 810 | * device_suspend - Save state and stop all devices in system. | 798 | * dpm_suspend_start - Save state and stop all devices in system. |
| 811 | * @state: PM transition of the system being carried out. | 799 | * @state: PM transition of the system being carried out. |
| 812 | * | 800 | * |
| 813 | * Prepare and suspend all devices. | 801 | * Prepare and suspend all devices. |
| 814 | */ | 802 | */ |
| 815 | int device_suspend(pm_message_t state) | 803 | int dpm_suspend_start(pm_message_t state) |
| 816 | { | 804 | { |
| 817 | int error; | 805 | int error; |
| 818 | 806 | ||
| @@ -822,7 +810,7 @@ int device_suspend(pm_message_t state) | |||
| 822 | error = dpm_suspend(state); | 810 | error = dpm_suspend(state); |
| 823 | return error; | 811 | return error; |
| 824 | } | 812 | } |
| 825 | EXPORT_SYMBOL_GPL(device_suspend); | 813 | EXPORT_SYMBOL_GPL(dpm_suspend_start); |
| 826 | 814 | ||
| 827 | void __suspend_report_result(const char *function, void *fn, int ret) | 815 | void __suspend_report_result(const char *function, void *fn, int ret) |
| 828 | { | 816 | { |
diff --git a/drivers/xen/manage.c b/drivers/xen/manage.c index d5b327ac4039..10d03d7931c4 100644 --- a/drivers/xen/manage.c +++ b/drivers/xen/manage.c | |||
| @@ -43,7 +43,7 @@ static int xen_suspend(void *data) | |||
| 43 | if (err) { | 43 | if (err) { |
| 44 | printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", | 44 | printk(KERN_ERR "xen_suspend: sysdev_suspend failed: %d\n", |
| 45 | err); | 45 | err); |
| 46 | device_resume_noirq(PMSG_RESUME); | 46 | dpm_resume_noirq(PMSG_RESUME); |
| 47 | return err; | 47 | return err; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| @@ -69,7 +69,7 @@ static int xen_suspend(void *data) | |||
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | sysdev_resume(); | 71 | sysdev_resume(); |
| 72 | device_resume_noirq(PMSG_RESUME); | 72 | dpm_resume_noirq(PMSG_RESUME); |
| 73 | 73 | ||
| 74 | return 0; | 74 | return 0; |
| 75 | } | 75 | } |
| @@ -92,18 +92,18 @@ static void do_suspend(void) | |||
| 92 | } | 92 | } |
| 93 | #endif | 93 | #endif |
| 94 | 94 | ||
| 95 | err = device_suspend(PMSG_SUSPEND); | 95 | err = dpm_suspend_start(PMSG_SUSPEND); |
| 96 | if (err) { | 96 | if (err) { |
| 97 | printk(KERN_ERR "xen suspend: device_suspend %d\n", err); | 97 | printk(KERN_ERR "xen suspend: dpm_suspend_start %d\n", err); |
| 98 | goto out; | 98 | goto out; |
| 99 | } | 99 | } |
| 100 | 100 | ||
| 101 | printk(KERN_DEBUG "suspending xenstore...\n"); | 101 | printk(KERN_DEBUG "suspending xenstore...\n"); |
| 102 | xs_suspend(); | 102 | xs_suspend(); |
| 103 | 103 | ||
| 104 | err = device_suspend_noirq(PMSG_SUSPEND); | 104 | err = dpm_suspend_noirq(PMSG_SUSPEND); |
| 105 | if (err) { | 105 | if (err) { |
| 106 | printk(KERN_ERR "device_suspend_noirq failed: %d\n", err); | 106 | printk(KERN_ERR "dpm_suspend_noirq failed: %d\n", err); |
| 107 | goto resume_devices; | 107 | goto resume_devices; |
| 108 | } | 108 | } |
| 109 | 109 | ||
| @@ -119,10 +119,10 @@ static void do_suspend(void) | |||
| 119 | } else | 119 | } else |
| 120 | xs_suspend_cancel(); | 120 | xs_suspend_cancel(); |
| 121 | 121 | ||
| 122 | device_resume_noirq(PMSG_RESUME); | 122 | dpm_resume_noirq(PMSG_RESUME); |
| 123 | 123 | ||
| 124 | resume_devices: | 124 | resume_devices: |
| 125 | device_resume(PMSG_RESUME); | 125 | dpm_resume_end(PMSG_RESUME); |
| 126 | 126 | ||
| 127 | /* Make sure timer events get retriggered on all CPUs */ | 127 | /* Make sure timer events get retriggered on all CPUs */ |
| 128 | clock_was_set(); | 128 | clock_was_set(); |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 2170252074f3..b3f74764a586 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -382,14 +382,13 @@ struct dev_pm_info { | |||
| 382 | #ifdef CONFIG_PM_SLEEP | 382 | #ifdef CONFIG_PM_SLEEP |
| 383 | extern void device_pm_lock(void); | 383 | extern void device_pm_lock(void); |
| 384 | extern int sysdev_resume(void); | 384 | extern int sysdev_resume(void); |
| 385 | extern void device_resume_noirq(pm_message_t state); | 385 | extern void dpm_resume_noirq(pm_message_t state); |
| 386 | extern void device_resume(pm_message_t state); | 386 | extern void dpm_resume_end(pm_message_t state); |
| 387 | 387 | ||
| 388 | extern void device_pm_unlock(void); | 388 | extern void device_pm_unlock(void); |
| 389 | extern int sysdev_suspend(pm_message_t state); | 389 | extern int sysdev_suspend(pm_message_t state); |
| 390 | extern int device_suspend_noirq(pm_message_t state); | 390 | extern int dpm_suspend_noirq(pm_message_t state); |
| 391 | extern int device_suspend(pm_message_t state); | 391 | extern int dpm_suspend_start(pm_message_t state); |
| 392 | extern int device_prepare_suspend(pm_message_t state); | ||
| 393 | 392 | ||
| 394 | extern void __suspend_report_result(const char *function, void *fn, int ret); | 393 | extern void __suspend_report_result(const char *function, void *fn, int ret); |
| 395 | 394 | ||
| @@ -403,7 +402,7 @@ extern void __suspend_report_result(const char *function, void *fn, int ret); | |||
| 403 | #define device_pm_lock() do {} while (0) | 402 | #define device_pm_lock() do {} while (0) |
| 404 | #define device_pm_unlock() do {} while (0) | 403 | #define device_pm_unlock() do {} while (0) |
| 405 | 404 | ||
| 406 | static inline int device_suspend(pm_message_t state) | 405 | static inline int dpm_suspend_start(pm_message_t state) |
| 407 | { | 406 | { |
| 408 | return 0; | 407 | return 0; |
| 409 | } | 408 | } |
diff --git a/kernel/kexec.c b/kernel/kexec.c index 5a3da87adae0..ae1c35201cc8 100644 --- a/kernel/kexec.c +++ b/kernel/kexec.c | |||
| @@ -1448,17 +1448,17 @@ int kernel_kexec(void) | |||
| 1448 | goto Restore_console; | 1448 | goto Restore_console; |
| 1449 | } | 1449 | } |
| 1450 | suspend_console(); | 1450 | suspend_console(); |
| 1451 | error = device_suspend(PMSG_FREEZE); | 1451 | error = dpm_suspend_start(PMSG_FREEZE); |
| 1452 | if (error) | 1452 | if (error) |
| 1453 | goto Resume_console; | 1453 | goto Resume_console; |
| 1454 | /* At this point, device_suspend() has been called, | 1454 | /* At this point, dpm_suspend_start() has been called, |
| 1455 | * but *not* device_suspend_noirq(). We *must* call | 1455 | * but *not* dpm_suspend_noirq(). We *must* call |
| 1456 | * device_suspend_noirq() now. Otherwise, drivers for | 1456 | * dpm_suspend_noirq() now. Otherwise, drivers for |
| 1457 | * some devices (e.g. interrupt controllers) become | 1457 | * some devices (e.g. interrupt controllers) become |
| 1458 | * desynchronized with the actual state of the | 1458 | * desynchronized with the actual state of the |
| 1459 | * hardware at resume time, and evil weirdness ensues. | 1459 | * hardware at resume time, and evil weirdness ensues. |
| 1460 | */ | 1460 | */ |
| 1461 | error = device_suspend_noirq(PMSG_FREEZE); | 1461 | error = dpm_suspend_noirq(PMSG_FREEZE); |
| 1462 | if (error) | 1462 | if (error) |
| 1463 | goto Resume_devices; | 1463 | goto Resume_devices; |
| 1464 | error = disable_nonboot_cpus(); | 1464 | error = disable_nonboot_cpus(); |
| @@ -1486,9 +1486,9 @@ int kernel_kexec(void) | |||
| 1486 | local_irq_enable(); | 1486 | local_irq_enable(); |
| 1487 | Enable_cpus: | 1487 | Enable_cpus: |
| 1488 | enable_nonboot_cpus(); | 1488 | enable_nonboot_cpus(); |
| 1489 | device_resume_noirq(PMSG_RESTORE); | 1489 | dpm_resume_noirq(PMSG_RESTORE); |
| 1490 | Resume_devices: | 1490 | Resume_devices: |
| 1491 | device_resume(PMSG_RESTORE); | 1491 | dpm_resume_end(PMSG_RESTORE); |
| 1492 | Resume_console: | 1492 | Resume_console: |
| 1493 | resume_console(); | 1493 | resume_console(); |
| 1494 | thaw_processes(); | 1494 | thaw_processes(); |
diff --git a/kernel/power/disk.c b/kernel/power/disk.c index 1c18bc894a2d..a9beba68b6c7 100644 --- a/kernel/power/disk.c +++ b/kernel/power/disk.c | |||
| @@ -215,13 +215,13 @@ static int create_image(int platform_mode) | |||
| 215 | if (error) | 215 | if (error) |
| 216 | return error; | 216 | return error; |
| 217 | 217 | ||
| 218 | /* At this point, device_suspend() has been called, but *not* | 218 | /* At this point, dpm_suspend_start() has been called, but *not* |
| 219 | * device_suspend_noirq(). We *must* call device_suspend_noirq() now. | 219 | * dpm_suspend_noirq(). We *must* call dpm_suspend_noirq() now. |
| 220 | * Otherwise, drivers for some devices (e.g. interrupt controllers) | 220 | * Otherwise, drivers for some devices (e.g. interrupt controllers) |
| 221 | * become desynchronized with the actual state of the hardware | 221 | * become desynchronized with the actual state of the hardware |
| 222 | * at resume time, and evil weirdness ensues. | 222 | * at resume time, and evil weirdness ensues. |
| 223 | */ | 223 | */ |
| 224 | error = device_suspend_noirq(PMSG_FREEZE); | 224 | error = dpm_suspend_noirq(PMSG_FREEZE); |
| 225 | if (error) { | 225 | if (error) { |
| 226 | printk(KERN_ERR "PM: Some devices failed to power down, " | 226 | printk(KERN_ERR "PM: Some devices failed to power down, " |
| 227 | "aborting hibernation\n"); | 227 | "aborting hibernation\n"); |
| @@ -262,7 +262,7 @@ static int create_image(int platform_mode) | |||
| 262 | 262 | ||
| 263 | Power_up: | 263 | Power_up: |
| 264 | sysdev_resume(); | 264 | sysdev_resume(); |
| 265 | /* NOTE: device_resume_noirq() is just a resume() for devices | 265 | /* NOTE: dpm_resume_noirq() is just a resume() for devices |
| 266 | * that suspended with irqs off ... no overall powerup. | 266 | * that suspended with irqs off ... no overall powerup. |
| 267 | */ | 267 | */ |
| 268 | 268 | ||
| @@ -275,7 +275,7 @@ static int create_image(int platform_mode) | |||
| 275 | Platform_finish: | 275 | Platform_finish: |
| 276 | platform_finish(platform_mode); | 276 | platform_finish(platform_mode); |
| 277 | 277 | ||
| 278 | device_resume_noirq(in_suspend ? | 278 | dpm_resume_noirq(in_suspend ? |
| 279 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); | 279 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); |
| 280 | 280 | ||
| 281 | return error; | 281 | return error; |
| @@ -304,7 +304,7 @@ int hibernation_snapshot(int platform_mode) | |||
| 304 | goto Close; | 304 | goto Close; |
| 305 | 305 | ||
| 306 | suspend_console(); | 306 | suspend_console(); |
| 307 | error = device_suspend(PMSG_FREEZE); | 307 | error = dpm_suspend_start(PMSG_FREEZE); |
| 308 | if (error) | 308 | if (error) |
| 309 | goto Recover_platform; | 309 | goto Recover_platform; |
| 310 | 310 | ||
| @@ -315,7 +315,7 @@ int hibernation_snapshot(int platform_mode) | |||
| 315 | /* Control returns here after successful restore */ | 315 | /* Control returns here after successful restore */ |
| 316 | 316 | ||
| 317 | Resume_devices: | 317 | Resume_devices: |
| 318 | device_resume(in_suspend ? | 318 | dpm_resume_end(in_suspend ? |
| 319 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); | 319 | (error ? PMSG_RECOVER : PMSG_THAW) : PMSG_RESTORE); |
| 320 | resume_console(); | 320 | resume_console(); |
| 321 | Close: | 321 | Close: |
| @@ -339,7 +339,7 @@ static int resume_target_kernel(bool platform_mode) | |||
| 339 | { | 339 | { |
| 340 | int error; | 340 | int error; |
| 341 | 341 | ||
| 342 | error = device_suspend_noirq(PMSG_QUIESCE); | 342 | error = dpm_suspend_noirq(PMSG_QUIESCE); |
| 343 | if (error) { | 343 | if (error) { |
| 344 | printk(KERN_ERR "PM: Some devices failed to power down, " | 344 | printk(KERN_ERR "PM: Some devices failed to power down, " |
| 345 | "aborting resume\n"); | 345 | "aborting resume\n"); |
| @@ -394,7 +394,7 @@ static int resume_target_kernel(bool platform_mode) | |||
| 394 | Cleanup: | 394 | Cleanup: |
| 395 | platform_restore_cleanup(platform_mode); | 395 | platform_restore_cleanup(platform_mode); |
| 396 | 396 | ||
| 397 | device_resume_noirq(PMSG_RECOVER); | 397 | dpm_resume_noirq(PMSG_RECOVER); |
| 398 | 398 | ||
| 399 | return error; | 399 | return error; |
| 400 | } | 400 | } |
| @@ -414,10 +414,10 @@ int hibernation_restore(int platform_mode) | |||
| 414 | 414 | ||
| 415 | pm_prepare_console(); | 415 | pm_prepare_console(); |
| 416 | suspend_console(); | 416 | suspend_console(); |
| 417 | error = device_suspend(PMSG_QUIESCE); | 417 | error = dpm_suspend_start(PMSG_QUIESCE); |
| 418 | if (!error) { | 418 | if (!error) { |
| 419 | error = resume_target_kernel(platform_mode); | 419 | error = resume_target_kernel(platform_mode); |
| 420 | device_resume(PMSG_RECOVER); | 420 | dpm_resume_end(PMSG_RECOVER); |
| 421 | } | 421 | } |
| 422 | resume_console(); | 422 | resume_console(); |
| 423 | pm_restore_console(); | 423 | pm_restore_console(); |
| @@ -447,14 +447,14 @@ int hibernation_platform_enter(void) | |||
| 447 | 447 | ||
| 448 | entering_platform_hibernation = true; | 448 | entering_platform_hibernation = true; |
| 449 | suspend_console(); | 449 | suspend_console(); |
| 450 | error = device_suspend(PMSG_HIBERNATE); | 450 | error = dpm_suspend_start(PMSG_HIBERNATE); |
| 451 | if (error) { | 451 | if (error) { |
| 452 | if (hibernation_ops->recover) | 452 | if (hibernation_ops->recover) |
| 453 | hibernation_ops->recover(); | 453 | hibernation_ops->recover(); |
| 454 | goto Resume_devices; | 454 | goto Resume_devices; |
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | error = device_suspend_noirq(PMSG_HIBERNATE); | 457 | error = dpm_suspend_noirq(PMSG_HIBERNATE); |
| 458 | if (error) | 458 | if (error) |
| 459 | goto Resume_devices; | 459 | goto Resume_devices; |
| 460 | 460 | ||
| @@ -479,11 +479,11 @@ int hibernation_platform_enter(void) | |||
| 479 | Platofrm_finish: | 479 | Platofrm_finish: |
| 480 | hibernation_ops->finish(); | 480 | hibernation_ops->finish(); |
| 481 | 481 | ||
| 482 | device_suspend_noirq(PMSG_RESTORE); | 482 | dpm_suspend_noirq(PMSG_RESTORE); |
| 483 | 483 | ||
| 484 | Resume_devices: | 484 | Resume_devices: |
| 485 | entering_platform_hibernation = false; | 485 | entering_platform_hibernation = false; |
| 486 | device_resume(PMSG_RESTORE); | 486 | dpm_resume_end(PMSG_RESTORE); |
| 487 | resume_console(); | 487 | resume_console(); |
| 488 | 488 | ||
| 489 | Close: | 489 | Close: |
diff --git a/kernel/power/main.c b/kernel/power/main.c index 2f6638ee03c0..46386b9f8dd1 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c | |||
| @@ -295,7 +295,7 @@ static int suspend_enter(suspend_state_t state) | |||
| 295 | return error; | 295 | return error; |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | error = device_suspend_noirq(PMSG_SUSPEND); | 298 | error = dpm_suspend_noirq(PMSG_SUSPEND); |
| 299 | if (error) { | 299 | if (error) { |
| 300 | printk(KERN_ERR "PM: Some devices failed to power down\n"); | 300 | printk(KERN_ERR "PM: Some devices failed to power down\n"); |
| 301 | goto Platfrom_finish; | 301 | goto Platfrom_finish; |
| @@ -335,7 +335,7 @@ static int suspend_enter(suspend_state_t state) | |||
| 335 | suspend_ops->wake(); | 335 | suspend_ops->wake(); |
| 336 | 336 | ||
| 337 | Power_up_devices: | 337 | Power_up_devices: |
| 338 | device_resume_noirq(PMSG_RESUME); | 338 | dpm_resume_noirq(PMSG_RESUME); |
| 339 | 339 | ||
| 340 | Platfrom_finish: | 340 | Platfrom_finish: |
| 341 | if (suspend_ops->finish) | 341 | if (suspend_ops->finish) |
| @@ -363,7 +363,7 @@ int suspend_devices_and_enter(suspend_state_t state) | |||
| 363 | } | 363 | } |
| 364 | suspend_console(); | 364 | suspend_console(); |
| 365 | suspend_test_start(); | 365 | suspend_test_start(); |
| 366 | error = device_suspend(PMSG_SUSPEND); | 366 | error = dpm_suspend_start(PMSG_SUSPEND); |
| 367 | if (error) { | 367 | if (error) { |
| 368 | printk(KERN_ERR "PM: Some devices failed to suspend\n"); | 368 | printk(KERN_ERR "PM: Some devices failed to suspend\n"); |
| 369 | goto Recover_platform; | 369 | goto Recover_platform; |
| @@ -376,7 +376,7 @@ int suspend_devices_and_enter(suspend_state_t state) | |||
| 376 | 376 | ||
| 377 | Resume_devices: | 377 | Resume_devices: |
| 378 | suspend_test_start(); | 378 | suspend_test_start(); |
| 379 | device_resume(PMSG_RESUME); | 379 | dpm_resume_end(PMSG_RESUME); |
| 380 | suspend_test_finish("resume devices"); | 380 | suspend_test_finish("resume devices"); |
| 381 | resume_console(); | 381 | resume_console(); |
| 382 | Close: | 382 | Close: |
