Skip to content

Commit fa39065

Browse files
tq-steinawsakernel
authored andcommitted
i2c: imx-lpi2c: 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. Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com> Signed-off-by: Wolfram Sang <wsa@kernel.org>
1 parent c770657 commit fa39065

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/i2c/busses/i2c-imx-lpi2c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ static int __maybe_unused lpi2c_runtime_suspend(struct device *dev)
639639
{
640640
struct lpi2c_imx_struct *lpi2c_imx = dev_get_drvdata(dev);
641641

642-
clk_bulk_disable_unprepare(lpi2c_imx->num_clks, lpi2c_imx->clks);
642+
clk_bulk_disable(lpi2c_imx->num_clks, lpi2c_imx->clks);
643643
pinctrl_pm_select_sleep_state(dev);
644644

645645
return 0;
@@ -651,7 +651,7 @@ static int __maybe_unused lpi2c_runtime_resume(struct device *dev)
651651
int ret;
652652

653653
pinctrl_pm_select_default_state(dev);
654-
ret = clk_bulk_prepare_enable(lpi2c_imx->num_clks, lpi2c_imx->clks);
654+
ret = clk_bulk_enable(lpi2c_imx->num_clks, lpi2c_imx->clks);
655655
if (ret) {
656656
dev_err(dev, "failed to enable I2C clock, ret=%d\n", ret);
657657
return ret;

0 commit comments

Comments
 (0)