[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220628021244.17281-1-peter.wang@mediatek.com>
Date: Tue, 28 Jun 2022 10:12:44 +0800
From: <peter.wang@...iatek.com>
To: <matthias.bgg@...il.com>, <len.brown@...el.com>, <pavel@....cz>,
<rafael@...nel.org>, <gregkh@...uxfoundation.org>,
<stanley.chu@...iatek.com>, <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-pm@...r.kernel.org>,
<martin.petersen@...cle.com>, <avri.altman@....com>,
<alim.akhtar@...sung.com>, <jejb@...ux.ibm.com>
CC: <wsd_upstream@...iatek.com>, <linux-mediatek@...ts.infradead.org>,
<peter.wang@...iatek.com>, <chun-hung.wu@...iatek.com>,
<alice.chao@...iatek.com>, <cc.chou@...iatek.com>,
<chaotian.jing@...iatek.com>, <jiajie.hao@...iatek.com>,
<powen.kao@...iatek.com>, <qilin.tan@...iatek.com>,
<lin.gui@...iatek.com>, <tun-yu.yu@...iatek.com>
Subject: [PATCH v2] PM-runtime: Check supplier_preactivated before release supplier
From: Peter Wang <peter.wang@...iatek.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@...iatek.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
Powered by blists - more mailing lists