* [PATCH] i2c: ocores: delete adapter before disabling controller
@ 2026-10-31 3:32 Matthias Goergens
2026-11-01 15:41 ` Andrew Lunn
0 siblings, 1 reply; 2+ messages in thread
From: Matthias Goergens @ 2026-10-31 3:32 UTC (permalink / raw)
To: Peter Korsgaard, Andrew Lunn, Andi Shyti; +Cc: linux-i2c, linux-kernel
i2c_del_adapter() unregisters child devices, and their removal
callbacks may perform I2C. Delete the adapter before disabling the
controller so those transactions still work.
Found by Sashiko AI review.
Link: https://sashiko.dev/#/patchset/20260813153155.3953577-1-ruoyuw560@gmail.com
---
drivers/i2c/busses/i2c-ocores.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index 2d18c1035837..ff024cf5f92d 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -720,14 +720,15 @@ static int ocores_i2c_probe(struct platform_device *pdev)
static void ocores_i2c_remove(struct platform_device *pdev)
{
struct ocores_i2c *i2c = platform_get_drvdata(pdev);
- u8 ctrl = oc_getreg(i2c, OCI2C_CONTROL);
+ u8 ctrl;
+
+ /* remove adapter & data */
+ i2c_del_adapter(&i2c->adap);
/* disable i2c logic */
+ ctrl = oc_getreg(i2c, OCI2C_CONTROL);
ctrl &= ~(OCI2C_CTRL_EN | OCI2C_CTRL_IEN);
oc_setreg(i2c, OCI2C_CONTROL, ctrl);
-
- /* remove adapter & data */
- i2c_del_adapter(&i2c->adap);
}
static int ocores_i2c_suspend(struct device *dev)
base-commit: d89e1d186ec9271bf78e62771779e9fc03bf0fc3
prerequisite-patch-id: 44b1c2680cb029871e123eb11eab7764a807ef24
prerequisite-patch-id: f4dfbbaaec2d208ac255451cf032c22f0e7fed2d
--
2.56.0
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-01 15:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-31 3:32 [PATCH] i2c: ocores: delete adapter before disabling controller Matthias Goergens
2026-11-01 15:41 ` Andrew Lunn
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®