[PATCH v1 1/3] PM / sleep: Check legacy pm callbacks for direct complete
From: Derek Basehore
Date: Wed Feb 24 2016 - 19:11:41 EST
This adds checks for legacy pm callbacks when setting no_pm_callbacks.
This fixes an issue where these suspend/resume callbacks were
incorrectly ignored during suspend/resume with direct complete.
Fixes: 4534d9d881f9 "PM / sleep: Go direct_complete if driver has..."
Signed-off-by: Derek Basehore <dbasehore@xxxxxxxxxxxx>
---
drivers/base/power/main.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index 6e7c3cc..e0017d9 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -1764,8 +1764,10 @@ void device_pm_check_callbacks(struct device *dev)
{
spin_lock_irq(&dev->power.lock);
dev->power.no_pm_callbacks =
- (!dev->bus || pm_ops_is_empty(dev->bus->pm)) &&
- (!dev->class || pm_ops_is_empty(dev->class->pm)) &&
+ (!dev->bus || (!dev->bus->resume && !dev->bus->suspend &&
+ pm_ops_is_empty(dev->bus->pm))) &&
+ (!dev->class || (!dev->class->resume && !dev->class->suspend &&
+ pm_ops_is_empty(dev->class->pm))) &&
(!dev->type || pm_ops_is_empty(dev->type->pm)) &&
(!dev->pm_domain || pm_ops_is_empty(&dev->pm_domain->ops)) &&
(!dev->driver || pm_ops_is_empty(dev->driver->pm));
--
2.7.0.rc3.207.g0ac5344