[PATCH] i2c: qup: do not disable the clocks twice in remove()
From: Cong Nguyen
Date: Wed Nov 25 2026 - 08:45:09 EST
qup_i2c_remove() disables the clocks unconditionally. If the controller
is already runtime suspended, the suspend callback has disabled them, so
they are disabled a second time.
It also does this before i2c_del_adapter(), so transfers from client
drivers in their remove() run with the clocks off.
Delete the adapter and disable runtime PM first, then disable the clocks
only if the device is not runtime suspended.
Fixes: 10c5a8425968 ("i2c: qup: New bus driver for the Qualcomm QUP I2C controller")
Signed-off-by: Cong Nguyen <congnt264@xxxxxxxxx>
---
drivers/i2c/busses/i2c-qup.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index 731bce9f9a92..f61ef2d3a10d 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -1960,15 +1960,17 @@ static void qup_i2c_remove(struct platform_device *pdev)
{
struct qup_i2c_dev *qup = platform_get_drvdata(pdev);
+ i2c_del_adapter(&qup->adap);
+ pm_runtime_disable(qup->dev);
+
if (qup->is_dma) {
dma_release_channel(qup->btx.dma);
dma_release_channel(qup->brx.dma);
}
disable_irq(qup->irq);
- qup_i2c_disable_clocks(qup);
- i2c_del_adapter(&qup->adap);
- pm_runtime_disable(qup->dev);
+ if (!pm_runtime_status_suspended(qup->dev))
+ qup_i2c_disable_clocks(qup);
pm_runtime_set_suspended(qup->dev);
}
--
2.25.1