[PATCH] i2c: altera: disable clock after removing adapter

Jiawen Liu <[email protected]>
Newsgroups org.kernel.vger.linux-i2c,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
From: jiawen <[email protected]>

In altr_i2c_remove(), the controller clock is disabled before
i2c_del_adapter() is called. This leaves the adapter teardown running
without the hardware clock, which can cause issues during adapter
removal.

Move the clk_disable_unprepare() call after i2c_del_adapter() to ensure
the adapter is removed while the clock is still available.

Signed-off-by: jiawen <[email protected]>
---
diff --git a/drivers/i2c/busses/i2c-altera.c b/drivers/i2c/busses/i2c-altera.c
--- a/drivers/i2c/busses/i2c-altera.c
+++ b/drivers/i2c/busses/i2c-altera.c
@@ -469,8 +469,8 @@
 {
 	struct altr_i2c_dev *idev = platform_get_drvdata(pdev);
 
+	i2c_del_adapter(&idev->adapter);
 	clk_disable_unprepare(idev->i2c_clk);
-	i2c_del_adapter(&idev->adapter);
 }
 
 /* Match table for of_platform binding */
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.