mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jiawen Liu <1298662399@qq.com>
To: Andi Shyti <andi.shyti@kernel.org>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] i2c: altera: remove clients before disabling the clock
Date: Sun, 29 Nov 2026 16:43:02 +0400	[thread overview]
Message-ID: <tencent_515A9547F54F45A59027BA654E298091BF08@qq.com> (raw)

altr_i2c_remove() disables the controller input clock before removing the
adapter. Adapter deletion synchronously invokes bound client remove
callbacks, and those callbacks can issue SMBus transfers. For example,
bh1750 sends a power-down command during removal.

Those transfers access Altera controller registers and wait for transfer
interrupts, which can fail after the clock has been gated. Remove the
adapter while its transfer resources are still available, then disable
the clock.

Fixes: 0560ad576268 ("i2c: altera: Add Altera I2C Controller driver")
Signed-off-by: Jiawen Liu <1298662399@qq.com>
---
 drivers/i2c/busses/i2c-altera.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-altera.c b/drivers/i2c/busses/i2c-altera.c
index 0174805ff822d..0bd30199df45b 100644
--- a/drivers/i2c/busses/i2c-altera.c
+++ b/drivers/i2c/busses/i2c-altera.c
@@ -469,8 +469,8 @@ static void altr_i2c_remove(struct platform_device *pdev)
 {
 	struct altr_i2c_dev *idev = platform_get_drvdata(pdev);
 
-	clk_disable_unprepare(idev->i2c_clk);
 	i2c_del_adapter(&idev->adapter);
+	clk_disable_unprepare(idev->i2c_clk);
 }
 
 /* Match table for of_platform binding */
-- 
2.34.1


                 reply	other threads:[~2026-11-29 14:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tencent_515A9547F54F45A59027BA654E298091BF08@qq.com \
    --to=1298662399@qq.com \
    --cc=andi.shyti@kernel.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®