[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250820153125.22002-2-jszhang@kernel.org>
Date: Wed, 20 Aug 2025 23:31:24 +0800
From: Jisheng Zhang <jszhang@...nel.org>
To: Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Jan Dabros <jsd@...ihalf.com>,
Andi Shyti <andi.shyti@...nel.org>
Cc: linux-kernel@...r.kernel.org,
linux-i2c@...r.kernel.org
Subject: [PATCH 1/2] i2c: designware: Avoid taking clk_prepare mutex in PM callbacks
This is unsafe, as the runtime PM callbacks are called from the PM
workqueue, so this may deadlock when handling an i2c attached clock,
which may already hold the clk_prepare mutex from another context.
Fixes: 1fc2fe204cb9 ("i2c: designware: Add runtime PM hooks")
Signed-off-by: Jisheng Zhang <jszhang@...nel.org>
---
drivers/i2c/busses/i2c-designware-common.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c
index 5b1e8f74c4ac..b4e38bc0f876 100644
--- a/drivers/i2c/busses/i2c-designware-common.c
+++ b/drivers/i2c/busses/i2c-designware-common.c
@@ -776,7 +776,8 @@ static int i2c_dw_runtime_suspend(struct device *device)
return 0;
i2c_dw_disable(dev);
- i2c_dw_prepare_clk(dev, false);
+ clk_disable(dev->clk);
+ clk_disable(dev->pclk);
return 0;
}
@@ -794,8 +795,10 @@ static int i2c_dw_runtime_resume(struct device *device)
{
struct dw_i2c_dev *dev = dev_get_drvdata(device);
- if (!dev->shared_with_punit)
- i2c_dw_prepare_clk(dev, true);
+ if (!dev->shared_with_punit) {
+ clk_enable(dev->pclk);
+ clk_enable(dev->clk);
+ }
dev->init(dev);
--
2.50.1
Powered by blists - more mailing lists