Commit 157c460e authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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: aa8e54b5 (PM / sleep: Go direct_complete if driver has no callbacks)
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: 4.5+ <stable@vger.kernel.org> # 4.5+
parent 2bd6bf03
...@@ -1860,10 +1860,13 @@ void device_pm_check_callbacks(struct device *dev) ...@@ -1860,10 +1860,13 @@ void device_pm_check_callbacks(struct device *dev)
{ {
spin_lock_irq(&dev->power.lock); spin_lock_irq(&dev->power.lock);
dev->power.no_pm_callbacks = dev->power.no_pm_callbacks =
(!dev->bus || pm_ops_is_empty(dev->bus->pm)) && (!dev->bus || (pm_ops_is_empty(dev->bus->pm) &&
(!dev->class || pm_ops_is_empty(dev->class->pm)) && !dev->bus->suspend && !dev->bus->resume)) &&
(!dev->class || (pm_ops_is_empty(dev->class->pm) &&
!dev->class->suspend && !dev->class->resume)) &&
(!dev->type || pm_ops_is_empty(dev->type->pm)) && (!dev->type || pm_ops_is_empty(dev->type->pm)) &&
(!dev->pm_domain || pm_ops_is_empty(&dev->pm_domain->ops)) && (!dev->pm_domain || pm_ops_is_empty(&dev->pm_domain->ops)) &&
(!dev->driver || pm_ops_is_empty(dev->driver->pm)); (!dev->driver || (pm_ops_is_empty(dev->driver->pm) &&
!dev->driver->suspend && !dev->driver->resume));
spin_unlock_irq(&dev->power.lock); spin_unlock_irq(&dev->power.lock);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment