[PATCH] i2c: s3c2410: remove clients before unpreparing the clock

From: Jiawen Liu

Date: Sun Nov 29 2026 - 09:15:52 EST


s3c24xx_i2c_remove() unprepares the controller clock before removing the
adapter. Adapter deletion synchronously invokes bound client remove
callbacks, which can issue SMBus transfers through their existing client
handle. For example, ina209 restores its configuration and calibration
during removal.

The transfer path calls clk_enable(), which fails if this was the final
clock preparation. Remove the adapter while its controller resources are
still available, then release runtime PM and the clock preparation.

Fixes: 34e81ad5f0b6 ("i2c: s3c2410: fix ABBA deadlock by keeping clock prepared")
Signed-off-by: Jiawen Liu <1298662399@xxxxxx>
---
drivers/i2c/busses/i2c-s3c2410.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 35583d7f34a74..7c6b2649784fd 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1136,11 +1136,11 @@ static void s3c24xx_i2c_remove(struct platform_device *pdev)
{
struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev);

+ i2c_del_adapter(&i2c->adap);
+
clk_unprepare(i2c->clk);

pm_runtime_disable(&pdev->dev);
-
- i2c_del_adapter(&i2c->adap);
}

static int s3c24xx_i2c_suspend_noirq(struct device *dev)
--
2.34.1