diff options
| author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2025-02-27 11:53:50 +0100 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-04-10 14:33:30 +0200 |
| commit | 528a06fe9862a2311af033a96e715f7129a8ff20 (patch) | |
| tree | a27f961be95c1cc0a24d5e11af01cc6337eb1208 /drivers/base | |
| parent | 53d472f97235346f77fc2c9305438b9d9a595229 (diff) | |
| download | linux-528a06fe9862a2311af033a96e715f7129a8ff20.tar.gz linux-528a06fe9862a2311af033a96e715f7129a8ff20.tar.bz2 linux-528a06fe9862a2311af033a96e715f7129a8ff20.zip | |
PM: sleep: Adjust check before setting power.must_resume
[ Upstream commit eeb87d17aceab7803a5a5bcb6cf2817b745157cf ]
The check before setting power.must_resume in device_suspend_noirq()
does not take power.child_count into account, but it should do that, so
use pm_runtime_need_not_resume() in it for this purpose and adjust the
comment next to it accordingly.
Fixes: 107d47b2b95e ("PM: sleep: core: Simplify the SMART_SUSPEND flag handling")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
Link: https://patch.msgid.link/3353728.44csPzL39Z@rjwysocki.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/base')
| -rw-r--r-- | drivers/base/power/main.c | 13 | ||||
| -rw-r--r-- | drivers/base/power/runtime.c | 2 |
2 files changed, 7 insertions, 8 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 9c5a5f4dba5a..49728cb628c1 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1236,14 +1236,13 @@ Skip: dev->power.is_noirq_suspended = true; /* - * Skipping the resume of devices that were in use right before the - * system suspend (as indicated by their PM-runtime usage counters) - * would be suboptimal. Also resume them if doing that is not allowed - * to be skipped. + * Devices must be resumed unless they are explicitly allowed to be left + * in suspend, but even in that case skipping the resume of devices that + * were in use right before the system suspend (as indicated by their + * runtime PM usage counters and child counters) would be suboptimal. */ - if (atomic_read(&dev->power.usage_count) > 1 || - !(dev_pm_test_driver_flags(dev, DPM_FLAG_MAY_SKIP_RESUME) && - dev->power.may_skip_resume)) + if (!(dev_pm_test_driver_flags(dev, DPM_FLAG_MAY_SKIP_RESUME) && + dev->power.may_skip_resume) || !pm_runtime_need_not_resume(dev)) dev->power.must_resume = true; if (dev->power.must_resume) diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index 14088b5adb55..bb68cba4d85a 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -1840,7 +1840,7 @@ void pm_runtime_drop_link(struct device_link *link) pm_request_idle(link->supplier); } -static bool pm_runtime_need_not_resume(struct device *dev) +bool pm_runtime_need_not_resume(struct device *dev) { return atomic_read(&dev->power.usage_count) <= 1 && (atomic_read(&dev->power.child_count) == 0 || |
