Skip to contentSkip to conversation

PM-runtime: Check supplier_preactivated before release supplier

PATCH New [email protected] 1 participant 1 message Jun 28, 2022

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 PM-runtime: Check supplier_preactivated before release supplier

From: Peter Wang <[email protected]>

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.

---
 drivers/base/power/runtime.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/base/power/runtime.c +4 -2
index 676dc72d912d..08bbc4561e60 100644
@@ -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)
Signature · 1 line
2.18.0