Skip to content

Commit 71723f9

Browse files
linuswrafaeljw
authored andcommitted
PM / runtime: print error when activating a child to unactive parent
The code currently silently bails out with -EBUSY if you try to activate a child to an inactive parent. This typically happens when you have a runtime suspended parent and runtime resume your child, but forgot to set .ignore_children on the parent to true with pm_suspend_ignore_children(dev). Silently ignoring this error is not good as it gives rise to other strange behaviour like double-resume of devices after silently bailing out of the .runtime_resume() callback. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 4c2e07c commit 71723f9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/base/power/runtime.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,10 +1045,14 @@ int __pm_runtime_set_status(struct device *dev, unsigned int status)
10451045
*/
10461046
if (!parent->power.disable_depth
10471047
&& !parent->power.ignore_children
1048-
&& parent->power.runtime_status != RPM_ACTIVE)
1048+
&& parent->power.runtime_status != RPM_ACTIVE) {
1049+
dev_err(dev, "runtime PM trying to activate child device %s but parent (%s) is not active\n",
1050+
dev_name(dev),
1051+
dev_name(parent));
10491052
error = -EBUSY;
1050-
else if (dev->power.runtime_status == RPM_SUSPENDED)
1053+
} else if (dev->power.runtime_status == RPM_SUSPENDED) {
10511054
atomic_inc(&parent->power.child_count);
1055+
}
10521056

10531057
spin_unlock(&parent->power.lock);
10541058

0 commit comments

Comments
 (0)