Skip to content

Commit c62ec46

Browse files
committed
PM / core: Fix direct_complete handling for devices with no callbacks
Commit 08810a4 (PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags) inadvertently prevented the power.direct_complete flag from being set for devices without PM callbacks and with disabled runtime PM which also prevents power.direct_complete from being set for their parents. That led to problems including a resume crash on HP ZBook 14u. Restore the previous behavior by causing power.direct_complete to be set for those devices again, but do that in a more direct way to avoid overlooking that case in the future. Link: https://bugzilla.kernel.org/show_bug.cgi?id=199693 Fixes: 08810a4 (PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags) Reported-by: Thomas Martitz <[email protected]> Tested-by: Thomas Martitz <[email protected]> Cc: 4.15+ <[email protected]> # 4.15+ Signed-off-by: Rafael J. Wysocki <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Reviewed-by: Johan Hovold <[email protected]>
1 parent 771c577 commit c62ec46

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/base/power/main.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1923,10 +1923,8 @@ static int device_prepare(struct device *dev, pm_message_t state)
19231923

19241924
dev->power.wakeup_path = false;
19251925

1926-
if (dev->power.no_pm_callbacks) {
1927-
ret = 1; /* Let device go direct_complete */
1926+
if (dev->power.no_pm_callbacks)
19281927
goto unlock;
1929-
}
19301928

19311929
if (dev->pm_domain)
19321930
callback = dev->pm_domain->ops.prepare;
@@ -1960,7 +1958,8 @@ static int device_prepare(struct device *dev, pm_message_t state)
19601958
*/
19611959
spin_lock_irq(&dev->power.lock);
19621960
dev->power.direct_complete = state.event == PM_EVENT_SUSPEND &&
1963-
pm_runtime_suspended(dev) && ret > 0 &&
1961+
((pm_runtime_suspended(dev) && ret > 0) ||
1962+
dev->power.no_pm_callbacks) &&
19641963
!dev_pm_test_driver_flags(dev, DPM_FLAG_NEVER_SKIP);
19651964
spin_unlock_irq(&dev->power.lock);
19661965
return 0;

0 commit comments

Comments
 (0)