aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-17 17:49:25 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-17 17:49:25 -0500
commite75080f185c103a638c66d7b65c673769a57cb87 (patch)
treefa8678e324f7e2225b652685162c15c0c932f970 /drivers
parentf6705bf959efac87bca76d40050d342f1d212587 (diff)
parent3e4c9e637df1fac4123db5f3165b0034226a671b (diff)
Merge tag 'pm-fixes-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull two power management fixes from Rafael Wysocki: "This is the change making /proc/cpuinfo on x86 report current CPU frequency in "cpu MHz" again in all cases and an additional one dealing with an overzealous check in one of the helper routines in the runtime PM framework" * tag 'pm-fixes-4.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: PM / runtime: Drop children check from __pm_runtime_set_status() x86 / CPU: Always show current CPU frequency in /proc/cpuinfo
Diffstat (limited to 'drivers')
-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)
1101 goto out; 1101 goto out;
1102 } 1102 }
1103 1103
1104 if (dev->power.runtime_status == status) 1104 if (dev->power.runtime_status == status || !parent)
1105 goto out_set; 1105 goto out_set;
1106 1106
1107 if (status == RPM_SUSPENDED) { 1107 if (status == RPM_SUSPENDED) {
1108 /* 1108 atomic_add_unless(&parent->power.child_count, -1, 0);
1109 * It is invalid to suspend a device with an active child, 1109 notify_parent = !parent->power.ignore_children;
1110 * unless it has been set to ignore its children. 1110 } else {
1111 */
1112 if (!dev->power.ignore_children &&
1113 atomic_read(&dev->power.child_count)) {
1114 dev_err(dev, "runtime PM trying to suspend device but active child\n");
1115 error = -EBUSY;
1116 goto out;
1117 }
1118
1119 if (parent) {
1120 atomic_add_unless(&parent->power.child_count, -1, 0);
1121 notify_parent = !parent->power.ignore_children;
1122 }
1123 goto out_set;
1124 }
1125
1126 if (parent) {
1127 spin_lock_nested(&parent->power.lock, SINGLE_DEPTH_NESTING); 1111 spin_lock_nested(&parent->power.lock, SINGLE_DEPTH_NESTING);
1128 1112
1129 /* 1113 /*
@@ -1307,6 +1291,13 @@ void pm_runtime_enable(struct device *dev)
1307 else 1291 else
1308 dev_warn(dev, "Unbalanced %s!\n", __func__); 1292 dev_warn(dev, "Unbalanced %s!\n", __func__);
1309 1293
1294 WARN(!dev->power.disable_depth &&
1295 dev->power.runtime_status == RPM_SUSPENDED &&
1296 !dev->power.ignore_children &&
1297 atomic_read(&dev->power.child_count) > 0,
1298 "Enabling runtime PM for inactive device (%s) with active children\n",
1299 dev_name(dev));
1300
1310 spin_unlock_irqrestore(&dev->power.lock, flags); 1301 spin_unlock_irqrestore(&dev->power.lock, flags);
1311} 1302}
1312EXPORT_SYMBOL_GPL(pm_runtime_enable); 1303EXPORT_SYMBOL_GPL(pm_runtime_enable);