pm: don't suspend unready devices when entering low power states

The PM subsystem should not call the PM control callbacks on
uninitialized devices when entering low-power states.

Signed-off-by: Corey Wharton <xodus7@cwharton.com>
This commit is contained in:
Corey Wharton 2022-12-14 11:24:22 -08:00 committed by Fabio Baltieri
commit 21a7c2d7eb
3 changed files with 34 additions and 5 deletions

View file

@ -69,12 +69,13 @@ static int pm_suspend_devices(void)
int ret;
/*
* ignore busy devices, wake up source and devices with
* runtime PM enabled.
* Ignore uninitialized devices, busy devices, wake up sources, and
* devices with runtime PM enabled.
*/
if (pm_device_is_busy(dev) || pm_device_state_is_locked(dev)
|| pm_device_wakeup_is_enabled(dev) ||
((dev->pm != NULL) && pm_device_runtime_is_enabled(dev))) {
if (!device_is_ready(dev) || pm_device_is_busy(dev) ||
pm_device_state_is_locked(dev) ||
pm_device_wakeup_is_enabled(dev) ||
pm_device_runtime_is_enabled(dev)) {
continue;
}