diff mbox series

[v2] PM-runtime: Check supplier_preactivated before release supplier

Message ID 20220628021244.17281-1-peter.wang@mediatek.com
State New
Headers show
Series [v2] PM-runtime: Check supplier_preactivated before release supplier | expand

Commit Message

Peter Wang (王信友) June 28, 2022, 2:12 a.m. UTC
From: Peter Wang <peter.wang@mediatek.com>

With divice link of DL_FLAG_PM_RUNTIME, if consumer call pm_runtime_get_suppliers
to prevent supplier enter suspend, pm_runtime_release_supplier should
check supplier_preactivated before let supplier enter suspend.

Signed-off-by: Peter Wang <peter.wang@mediatek.com>
---
 drivers/base/power/runtime.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c
index 676dc72d912d..08bbc4561e60 100644
--- a/drivers/base/power/runtime.c
+++ b/drivers/base/power/runtime.c
@@ -337,8 +337,10 @@  static void __rpm_put_suppliers(struct device *dev, bool try_to_suspend)
 	struct device_link *link;
 
 	list_for_each_entry_rcu(link, &dev->links.suppliers, c_node,
-				device_links_read_lock_held())
-		pm_runtime_release_supplier(link, try_to_suspend);
+				device_links_read_lock_held()) {
+		if (!link->supplier_preactivated)
+			pm_runtime_release_supplier(link, try_to_suspend);
+	}
 }
 
 static void rpm_put_suppliers(struct device *dev)