summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2018-05-24 11:33:36 +0300
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-05-27 13:18:55 +0300
commita0504aecba76baa1cddbc23512eb8be14df74cef (patch)
treee77b3dd0c67e21445e6cf94ee6cd2899451772cf /drivers/base
parent1e8378619841ef1d621b130bbd3fc3b7e6739b50 (diff)
downloadlinux-a0504aecba76baa1cddbc23512eb8be14df74cef.tar.xz
PM / runtime: Drop usage count for suppliers at device link removal
In the case consumer device is runtime resumed, while the link to the supplier is removed, the earlier call to pm_runtime_get_sync() made from rpm_get_suppliers() does not get properly balanced with a corresponding call to pm_runtime_put(). This leads to that suppliers remains to be runtime resumed forever, while they don't need to. Let's fix the behaviour by calling rpm_put_suppliers() when dropping a device link. Not that, since rpm_put_suppliers() checks the link->rpm_active flag, we can correctly avoid to call pm_runtime_put() in cases when we shouldn't. Reported-by: Todor Tomov <todor.tomov@linaro.org> Fixes: 21d5c57b3726 (PM / runtime: Use device links) Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/power/runtime.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 6f4f50e196c1..c6030f100c08 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -1586,6 +1586,8 @@ void pm_runtime_new_link(struct device *dev)
void pm_runtime_drop_link(struct device *dev)
{
+ rpm_put_suppliers(dev);
+
spin_lock_irq(&dev->power.lock);
WARN_ON(dev->power.links_count == 0);
dev->power.links_count--;