Skip to content

Commit 157c460

Browse files
committed
PM: core: Fix device_pm_check_callbacks()
The device_pm_check_callbacks() function doesn't check legacy ->suspend and ->resume callback pointers under the device's bus type, class and driver, so in some cases it may set the no_pm_callbacks flag for the device incorrectly and then the callbacks may be skipped during system suspend/resume, which shouldn't happen. Fixes: aa8e54b (PM / sleep: Go direct_complete if driver has no callbacks) Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Cc: 4.5+ <stable@vger.kernel.org> # 4.5+
1 parent 2bd6bf0 commit 157c460

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎drivers/base/power/main.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,10 +1860,13 @@ void device_pm_check_callbacks(struct device *dev)
18601860
{
18611861
spin_lock_irq(&dev->power.lock);
18621862
dev->power.no_pm_callbacks =
1863-
(!dev->bus || pm_ops_is_empty(dev->bus->pm)) &&
1864-
(!dev->class || pm_ops_is_empty(dev->class->pm)) &&
1863+
(!dev->bus || (pm_ops_is_empty(dev->bus->pm) &&
1864+
!dev->bus->suspend && !dev->bus->resume)) &&
1865+
(!dev->class || (pm_ops_is_empty(dev->class->pm) &&
1866+
!dev->class->suspend && !dev->class->resume)) &&
18651867
(!dev->type || pm_ops_is_empty(dev->type->pm)) &&
18661868
(!dev->pm_domain || pm_ops_is_empty(&dev->pm_domain->ops)) &&
1867-
(!dev->driver || pm_ops_is_empty(dev->driver->pm));
1869+
(!dev->driver || (pm_ops_is_empty(dev->driver->pm) &&
1870+
!dev->driver->suspend && !dev->driver->resume));
18681871
spin_unlock_irq(&dev->power.lock);
18691872
}

0 commit comments

Comments
 (0)