diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2025-02-27 11:53:50 +0100 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2025-03-03 14:31:47 +0100 |
commit | eeb87d17aceab7803a5a5bcb6cf2817b745157cf (patch) | |
tree | 63bc2ff2cd8a3f1a0e8d6754acac234611c6749d /drivers/base/power/main.c | |
parent | 630d55e038728f6f5917da051984a5ec515d152e (diff) |
PM: sleep: Adjust check before setting power.must_resume
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
Diffstat (limited to 'drivers/base/power/main.c')
-rw-r--r-- | drivers/base/power/main.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index e4103d29a21a..b03cdbc75b6d 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c @@ -1277,14 +1277,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) |