Linux Serial subsystem development
 help / color / mirror / Atom feed
* [PATCH] serial: uartlite: Resume the device before disabling the clock on remove
@ 2026-12-01 19:19 Arina Kharlamova via B4 Relay
  2026-12-01 19:33 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Arina Kharlamova via B4 Relay @ 2026-12-01 19:19 UTC (permalink / raw)
  To: Peter Korsgaard, Greg Kroah-Hartman, Jiri Slaby, Chuhong Yuan
  Cc: linux-serial, linux-kernel, Arina Kharlamova

From: Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>

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@mbzuai.ac.ae>
---
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@mbzuai.ac.ae>



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-01 19:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-01 19:19 [PATCH] serial: uartlite: Resume the device before disabling the clock on remove Arina Kharlamova via B4 Relay
2026-12-01 19:33 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox