summaryrefslogtreecommitdiffstats
path: root/drivers/base/core.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-02-01 01:52:45 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-02-01 10:04:08 +0100
commita1fdbfbb1da2063ba98a12eb6f1bdd07451c7145 (patch)
tree66bacdad52989ed99eab7c402cd0c618ec61f271 /drivers/base/core.c
parent15cfb094160385cc0b303c4cda483caa102af654 (diff)
downloadblackbird-op-linux-a1fdbfbb1da2063ba98a12eb6f1bdd07451c7145.tar.gz
blackbird-op-linux-a1fdbfbb1da2063ba98a12eb6f1bdd07451c7145.zip
driver core: Do not call rpm_put_suppliers() in pm_runtime_drop_link()
Calling rpm_put_suppliers() from pm_runtime_drop_link() is excessive as it affects all suppliers of the consumer device and not just the one pointed to by the device link being dropped. Worst case it may cause the consumer device to stop working unexpectedly. Moreover, in principle it is racy with respect to runtime PM of the consumer device. To avoid these problems drop runtime PM references on the particular supplier pointed to by the link in question only and do that after the link has been dropped from the consumer device's list of links to suppliers, which is in device_link_free(). Fixes: a0504aecba76 ("PM / runtime: Drop usage count for suppliers at device link removal") Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r--drivers/base/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c
index d58ea075f807..8c7327d45406 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -374,6 +374,9 @@ EXPORT_SYMBOL_GPL(device_link_add);
static void device_link_free(struct device_link *link)
{
+ while (refcount_dec_not_one(&link->rpm_active))
+ pm_runtime_put(link->supplier);
+
put_device(link->consumer);
put_device(link->supplier);
kfree(link);
OpenPOWER on IntegriCloud