diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-09-29 20:21:34 -0400 |
|---|---|---|
| committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2014-09-30 15:05:59 -0400 |
| commit | 2a8a8ce651d3a88fdf83e2ed15633c8d19292108 (patch) | |
| tree | ff98d7ff5d31ffeeacc117d910a63264a625efc7 | |
| parent | e1253e5e3fcd61f1057ef8a39c8c64e6b82358b9 (diff) | |
PM / sleep: Export dpm_suspend_late/noirq() and dpm_resume_early/noirq()
Subsequent change sets will add platform-related operations between
dpm_suspend_late() and dpm_suspend_noirq() as well as between
dpm_resume_noirq() and dpm_resume_early() in suspend_enter(), so
export these functions for suspend_enter() to be able to call them
separately and split the invocations of dpm_suspend_end() and
dpm_resume_start() in there accordingly.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
| -rw-r--r-- | drivers/base/power/main.c | 8 | ||||
| -rw-r--r-- | include/linux/pm.h | 4 | ||||
| -rw-r--r-- | kernel/power/suspend.c | 14 |
3 files changed, 19 insertions, 7 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index b67d9aef9fe4..44973196d3fd 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -540,7 +540,7 @@ static void async_resume_noirq(void *data, async_cookie_t cookie) | |||
| 540 | * Call the "noirq" resume handlers for all devices in dpm_noirq_list and | 540 | * Call the "noirq" resume handlers for all devices in dpm_noirq_list and |
| 541 | * enable device drivers to receive interrupts. | 541 | * enable device drivers to receive interrupts. |
| 542 | */ | 542 | */ |
| 543 | static void dpm_resume_noirq(pm_message_t state) | 543 | void dpm_resume_noirq(pm_message_t state) |
| 544 | { | 544 | { |
| 545 | struct device *dev; | 545 | struct device *dev; |
| 546 | ktime_t starttime = ktime_get(); | 546 | ktime_t starttime = ktime_get(); |
| @@ -662,7 +662,7 @@ static void async_resume_early(void *data, async_cookie_t cookie) | |||
| 662 | * dpm_resume_early - Execute "early resume" callbacks for all devices. | 662 | * dpm_resume_early - Execute "early resume" callbacks for all devices. |
| 663 | * @state: PM transition of the system being carried out. | 663 | * @state: PM transition of the system being carried out. |
| 664 | */ | 664 | */ |
| 665 | static void dpm_resume_early(pm_message_t state) | 665 | void dpm_resume_early(pm_message_t state) |
| 666 | { | 666 | { |
| 667 | struct device *dev; | 667 | struct device *dev; |
| 668 | ktime_t starttime = ktime_get(); | 668 | ktime_t starttime = ktime_get(); |
| @@ -1093,7 +1093,7 @@ static int device_suspend_noirq(struct device *dev) | |||
| 1093 | * Prevent device drivers from receiving interrupts and call the "noirq" suspend | 1093 | * Prevent device drivers from receiving interrupts and call the "noirq" suspend |
| 1094 | * handlers for all non-sysdev devices. | 1094 | * handlers for all non-sysdev devices. |
| 1095 | */ | 1095 | */ |
| 1096 | static int dpm_suspend_noirq(pm_message_t state) | 1096 | int dpm_suspend_noirq(pm_message_t state) |
| 1097 | { | 1097 | { |
| 1098 | ktime_t starttime = ktime_get(); | 1098 | ktime_t starttime = ktime_get(); |
| 1099 | int error = 0; | 1099 | int error = 0; |
| @@ -1232,7 +1232,7 @@ static int device_suspend_late(struct device *dev) | |||
| 1232 | * dpm_suspend_late - Execute "late suspend" callbacks for all devices. | 1232 | * dpm_suspend_late - Execute "late suspend" callbacks for all devices. |
| 1233 | * @state: PM transition of the system being carried out. | 1233 | * @state: PM transition of the system being carried out. |
| 1234 | */ | 1234 | */ |
| 1235 | static int dpm_suspend_late(pm_message_t state) | 1235 | int dpm_suspend_late(pm_message_t state) |
| 1236 | { | 1236 | { |
| 1237 | ktime_t starttime = ktime_get(); | 1237 | ktime_t starttime = ktime_get(); |
| 1238 | int error = 0; | 1238 | int error = 0; |
diff --git a/include/linux/pm.h b/include/linux/pm.h index 72c0fe098a27..e1c00b7ee913 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h | |||
| @@ -679,12 +679,16 @@ struct dev_pm_domain { | |||
| 679 | extern void device_pm_lock(void); | 679 | extern void device_pm_lock(void); |
| 680 | extern void dpm_resume_start(pm_message_t state); | 680 | extern void dpm_resume_start(pm_message_t state); |
| 681 | extern void dpm_resume_end(pm_message_t state); | 681 | extern void dpm_resume_end(pm_message_t state); |
| 682 | extern void dpm_resume_noirq(pm_message_t state); | ||
| 683 | extern void dpm_resume_early(pm_message_t state); | ||
| 682 | extern void dpm_resume(pm_message_t state); | 684 | extern void dpm_resume(pm_message_t state); |
| 683 | extern void dpm_complete(pm_message_t state); | 685 | extern void dpm_complete(pm_message_t state); |
| 684 | 686 | ||
| 685 | extern void device_pm_unlock(void); | 687 | extern void device_pm_unlock(void); |
| 686 | extern int dpm_suspend_end(pm_message_t state); | 688 | extern int dpm_suspend_end(pm_message_t state); |
| 687 | extern int dpm_suspend_start(pm_message_t state); | 689 | extern int dpm_suspend_start(pm_message_t state); |
| 690 | extern int dpm_suspend_noirq(pm_message_t state); | ||
| 691 | extern int dpm_suspend_late(pm_message_t state); | ||
| 688 | extern int dpm_suspend(pm_message_t state); | 692 | extern int dpm_suspend(pm_message_t state); |
| 689 | extern int dpm_prepare(pm_message_t state); | 693 | extern int dpm_prepare(pm_message_t state); |
| 690 | 694 | ||
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c index e837dd6783c6..58ae98b7dc2b 100644 --- a/kernel/power/suspend.c +++ b/kernel/power/suspend.c | |||
| @@ -265,11 +265,16 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) | |||
| 265 | if (error) | 265 | if (error) |
| 266 | goto Platform_finish; | 266 | goto Platform_finish; |
| 267 | 267 | ||
| 268 | error = dpm_suspend_end(PMSG_SUSPEND); | 268 | error = dpm_suspend_late(PMSG_SUSPEND); |
| 269 | if (error) { | 269 | if (error) { |
| 270 | printk(KERN_ERR "PM: Some devices failed to power down\n"); | 270 | printk(KERN_ERR "PM: late suspend of devices failed\n"); |
| 271 | goto Platform_finish; | 271 | goto Platform_finish; |
| 272 | } | 272 | } |
| 273 | error = dpm_suspend_noirq(PMSG_SUSPEND); | ||
| 274 | if (error) { | ||
| 275 | printk(KERN_ERR "PM: noirq suspend of devices failed\n"); | ||
| 276 | goto Devices_early_resume; | ||
| 277 | } | ||
| 273 | error = platform_suspend_prepare_late(state); | 278 | error = platform_suspend_prepare_late(state); |
| 274 | if (error) | 279 | if (error) |
| 275 | goto Platform_wake; | 280 | goto Platform_wake; |
| @@ -319,7 +324,10 @@ static int suspend_enter(suspend_state_t state, bool *wakeup) | |||
| 319 | 324 | ||
| 320 | Platform_wake: | 325 | Platform_wake: |
| 321 | platform_suspend_wake(state); | 326 | platform_suspend_wake(state); |
| 322 | dpm_resume_start(PMSG_RESUME); | 327 | dpm_resume_noirq(PMSG_RESUME); |
| 328 | |||
| 329 | Devices_early_resume: | ||
| 330 | dpm_resume_early(PMSG_RESUME); | ||
| 323 | 331 | ||
| 324 | Platform_finish: | 332 | Platform_finish: |
| 325 | platform_suspend_finish(state); | 333 | platform_suspend_finish(state); |
