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

peter.wang at mediatek.com peter.wang at mediatek.com
Mon Jun 27 19:12:44 PDT 2022


From: Peter Wang <peter.wang at 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 at mediatek.com>
---
 drivers/base/power/runtime.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

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)
-- 
2.18.0




More information about the Linux-mediatek mailing list