mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Arina Kharlamova via B4 Relay <devnull+arina.kharlamova.mbzuai.ac.ae@kernel.org>
To: Peter Korsgaard <jacmet@sunsite.dk>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Jiri Slaby <jirislaby@kernel.org>,
	Chuhong Yuan <hslester96@gmail.com>
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Arina Kharlamova <arina.kharlamova@mbzuai.ac.ae>
Subject: [PATCH] serial: uartlite: Resume the device before disabling the clock on remove
Date: Tue, 01 Dec 2026 23:19:25 +0400	[thread overview]
Message-ID: <20261201-uartlite-remove-clk-v1-1-bdffc49566f6@mbzuai.ac.ae> (raw)

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>



                 reply	other threads:[~2026-12-01 19:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261201-uartlite-remove-clk-v1-1-bdffc49566f6@mbzuai.ac.ae \
    --to=devnull+arina.kharlamova.mbzuai.ac.ae@kernel.org \
    --cc=arina.kharlamova@mbzuai.ac.ae \
    --cc=gregkh@linuxfoundation.org \
    --cc=hslester96@gmail.com \
    --cc=jacmet@sunsite.dk \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®