summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-11-17 14:44:50 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2017-11-17 14:44:50 +0100
commit3e4c9e637df1fac4123db5f3165b0034226a671b (patch)
tree0a81877a1bd1ed887330c8c06dc485ee172dfbc1 /drivers/base
parent7d5905dc14a87805a59f3c5bf70173aac2bb18f8 (diff)
parentf8817f61e8215b0ff1b73a0d33fa04ef9e6bce8b (diff)
downloadlinux-3e4c9e637df1fac4123db5f3165b0034226a671b.tar.gz
linux-3e4c9e637df1fac4123db5f3165b0034226a671b.tar.bz2
linux-3e4c9e637df1fac4123db5f3165b0034226a671b.zip
Merge branch 'pm-core'
* pm-core: PM / runtime: Drop children check from __pm_runtime_set_status()
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/runtime.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 2362b9e9701e..027d159ac381 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -1101,29 +1101,13 @@ int __pm_runtime_set_status(struct device *dev, unsigned int status)
goto out;
}
- if (dev->power.runtime_status == status)
+ if (dev->power.runtime_status == status || !parent)
goto out_set;
if (status == RPM_SUSPENDED) {
- /*
- * It is invalid to suspend a device with an active child,
- * unless it has been set to ignore its children.
- */
- if (!dev->power.ignore_children &&
- atomic_read(&dev->power.child_count)) {
- dev_err(dev, "runtime PM trying to suspend device but active child\n");
- error = -EBUSY;
- goto out;
- }
-
- if (parent) {
- atomic_add_unless(&parent->power.child_count, -1, 0);
- notify_parent = !parent->power.ignore_children;
- }
- goto out_set;
- }
-
- if (parent) {
+ atomic_add_unless(&parent->power.child_count, -1, 0);
+ notify_parent = !parent->power.ignore_children;
+ } else {
spin_lock_nested(&parent->power.lock, SINGLE_DEPTH_NESTING);
/*
@@ -1307,6 +1291,13 @@ void pm_runtime_enable(struct device *dev)
else
dev_warn(dev, "Unbalanced %s!\n", __func__);
+ WARN(!dev->power.disable_depth &&
+ dev->power.runtime_status == RPM_SUSPENDED &&
+ !dev->power.ignore_children &&
+ atomic_read(&dev->power.child_count) > 0,
+ "Enabling runtime PM for inactive device (%s) with active children\n",
+ dev_name(dev));
+
spin_unlock_irqrestore(&dev->power.lock, flags);
}
EXPORT_SYMBOL_GPL(pm_runtime_enable);