[PATCH] serial: uartlite: Resume the device before disabling the clock on remove

From: Arina Kharlamova via B4 Relay

Date: Tue Dec 01 2026 - 14:19:45 EST


From: Arina Kharlamova <arina.kharlamova@xxxxxxxxxxxx>

ulite_runtime_suspend() disables the clock, and ulite_remove() calls
clk_disable_unprepare() without looking at the runtime PM state. A
port that is not a console and is not open is runtime suspended after
probe, so unbinding it disables the clock a second time and the clk
core warns "already disabled".

Take a runtime PM reference at the start of ulite_remove(), so the
clock is on when it is disabled and no runtime suspend can run during
the remove, and drop it after runtime PM is disabled.

Fixes: 6a7ce07d6cb7 ("tty: serial: uartlite: use clk_disable_unprepare to match clk_prepare_enable")
Signed-off-by: Arina Kharlamova <arina.kharlamova@xxxxxxxxxxxx>
---
ulite_remove() disables the clock even when the port is runtime
suspended and the clock is already off. The patch resumes the device
first.

I noticed this while reviewing a related fix in the same driver. With
the help of an AI coding assistant (Claude); I reviewed the analysis and
the fix. Compile-tested only, not tested on hardware.
---
drivers/tty/serial/uartlite.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c
index b9a14dc2f2fd..993569d3432d 100644
--- a/drivers/tty/serial/uartlite.c
+++ b/drivers/tty/serial/uartlite.c
@@ -893,10 +893,12 @@ static void ulite_remove(struct platform_device *pdev)
struct uart_port *port = dev_get_drvdata(&pdev->dev);
struct uartlite_data *pdata = port->private_data;

+ pm_runtime_get_sync(&pdev->dev);
clk_disable_unprepare(pdata->clk);
ulite_release(&pdev->dev);
pm_runtime_disable(&pdev->dev);
pm_runtime_set_suspended(&pdev->dev);
+ pm_runtime_put_noidle(&pdev->dev);
pm_runtime_dont_use_autosuspend(&pdev->dev);
}


---
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
change-id: 20261201-uartlite-remove-clk-9dfc2176f6c9

Best regards,
--
Arina Kharlamova <arina.kharlamova@xxxxxxxxxxxx>