Skip to content

Commit f67ffa9

Browse files
committed
Merge branch 'pm-sleep'
* pm-sleep: PM: Move disabling/enabling runtime PM to late suspend/early resume
2 parents 868b093 + 9f6d8f6 commit f67ffa9

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

Documentation/power/runtime_pm.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -642,12 +642,13 @@ out the following operations:
642642
* During system suspend it calls pm_runtime_get_noresume() and
643643
pm_runtime_barrier() for every device right before executing the
644644
subsystem-level .suspend() callback for it. In addition to that it calls
645-
pm_runtime_disable() for every device right after executing the
646-
subsystem-level .suspend() callback for it.
645+
__pm_runtime_disable() with 'false' as the second argument for every device
646+
right before executing the subsystem-level .suspend_late() callback for it.
647647

648648
* During system resume it calls pm_runtime_enable() and pm_runtime_put_sync()
649-
for every device right before and right after executing the subsystem-level
650-
.resume() callback for it, respectively.
649+
for every device right after executing the subsystem-level .resume_early()
650+
callback and right after executing the subsystem-level .resume() callback
651+
for it, respectively.
651652

652653
7. Generic subsystem callbacks
653654

drivers/base/power/main.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -513,6 +513,8 @@ static int device_resume_early(struct device *dev, pm_message_t state)
513513

514514
Out:
515515
TRACE_RESUME(error);
516+
517+
pm_runtime_enable(dev);
516518
return error;
517519
}
518520

@@ -589,8 +591,6 @@ static int device_resume(struct device *dev, pm_message_t state, bool async)
589591
if (!dev->power.is_suspended)
590592
goto Unlock;
591593

592-
pm_runtime_enable(dev);
593-
594594
if (dev->pm_domain) {
595595
info = "power domain ";
596596
callback = pm_op(&dev->pm_domain->ops, state);
@@ -930,6 +930,8 @@ static int device_suspend_late(struct device *dev, pm_message_t state)
930930
pm_callback_t callback = NULL;
931931
char *info = NULL;
932932

933+
__pm_runtime_disable(dev, false);
934+
933935
if (dev->power.syscore)
934936
return 0;
935937

@@ -1133,11 +1135,8 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
11331135

11341136
Complete:
11351137
complete_all(&dev->power.completion);
1136-
11371138
if (error)
11381139
async_error = error;
1139-
else if (dev->power.is_suspended)
1140-
__pm_runtime_disable(dev, false);
11411140

11421141
return error;
11431142
}

0 commit comments

Comments
 (0)