PM: sleep: core: Rework the power.may_skip_resume handling

Because the power.may_skip_resume device status bit is taken
into account in combination with the DPM_FLAG_LEAVE_SUSPENDED
driver flag, it can be set to 'true' for all devices in the
"suspend" phase of a suspend-resume cycle, so do that.

Then, neither the PM core nor the middle-layer (sybsystem) code
handling it needs to set it to 'true' any more and it just has
to be cleared if there is a reason to avoid skipping the "noirq"
and "early" resume callbacks provided by the driver, so update
the code in question accordingly.

Suggested-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
Rafael J. Wysocki
2020-04-18 18:52:19 +02:00
parent 6e176bf8d4
commit 0fe8a1be59
3 changed files with 8 additions and 18 deletions

View File

@@ -1415,14 +1415,8 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as
if (callback)
goto Run;
if (dev_pm_smart_suspend_and_suspended(dev)) {
/*
* In principle, the resume of the device may be skippend if it
* remains in runtime suspend at this point.
*/
dev->power.may_skip_resume = true;
if (dev_pm_smart_suspend_and_suspended(dev))
goto Skip;
}
if (dev->driver && dev->driver->pm) {
info = "late driver ";
@@ -1647,7 +1641,7 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
dev->power.direct_complete = false;
}
dev->power.may_skip_resume = false;
dev->power.may_skip_resume = true;
dev->power.must_resume = false;
dpm_watchdog_set(&wd, dev);