Skip to contentSkip to conversation

i2c: qup: do not disable the clocks twice in remove()

PATCH New Cong Nguyen 1 participant 1 message Nov 25

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: qup: do not disable the clocks twice in remove()

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")
---
 drivers/i2c/busses/i2c-qup.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/i2c/busses/i2c-qup.c +5 -3
index 731bce9f9a92..f61ef2d3a10d 100644
@@ -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);
 }
 
Signature · 1 line
2.25.1