From: Alexey Charkov <alchark@gmail.com>
To: Alexey Charkov <alchark@gmail.com>,
Krzysztof Kozlowski <krzk@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Tony Prisk <linux@prisktech.co.nz>,
Alan Cox <alan@linux.intel.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
Greg Kroah-Hartman <gregkh@suse.de>,
Wentao Liang <vulab@iscas.ac.cn>
Subject: [PATCH 2/4] serial: vt8500: Use devm_clk_get_enabled()
Date: Wed, 11 Nov 2026 23:19:17 +0400 [thread overview]
Message-ID: <20261111-vt8500-serial-cleanup-v1-2-b33594a25f87@gmail.com> (raw)
In-Reply-To: <20261111-vt8500-serial-cleanup-v1-0-b33594a25f87@gmail.com>
Let devres own the UART clock, so that no probe error path, present or
future, has to remember to disable and put it.
Pass the clock lookup error up through dev_err_probe() instead of
replacing it with -EINVAL, so that a clock provider that is not ready
yet defers the probe rather than failing it for good.
Signed-off-by: Alexey Charkov <alchark@gmail.com>
---
drivers/tty/serial/vt8500_serial.c | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/drivers/tty/serial/vt8500_serial.c b/drivers/tty/serial/vt8500_serial.c
index 6c53e108756a..17f928a7073a 100644
--- a/drivers/tty/serial/vt8500_serial.c
+++ b/drivers/tty/serial/vt8500_serial.c
@@ -600,7 +600,6 @@ static int vt8500_serial_probe(struct platform_device *pdev)
struct resource *mmres;
struct device_node *np = pdev->dev.of_node;
const unsigned int *flags;
- int ret;
int port;
int irq;
@@ -643,18 +642,10 @@ static int vt8500_serial_probe(struct platform_device *pdev)
if (IS_ERR(vt8500_port->uart.membase))
return PTR_ERR(vt8500_port->uart.membase);
- vt8500_port->clk = of_clk_get(pdev->dev.of_node, 0);
- if (IS_ERR(vt8500_port->clk)) {
- dev_err(&pdev->dev, "failed to get clock\n");
- return -EINVAL;
- }
-
- ret = clk_prepare_enable(vt8500_port->clk);
- if (ret) {
- dev_err(&pdev->dev, "failed to enable clock\n");
- clk_put(vt8500_port->clk);
- return ret;
- }
+ vt8500_port->clk = devm_clk_get_enabled(&pdev->dev, NULL);
+ if (IS_ERR(vt8500_port->clk))
+ return dev_err_probe(&pdev->dev, PTR_ERR(vt8500_port->clk),
+ "failed to get clock\n");
vt8500_port->vt8500_uart_flags = *flags;
vt8500_port->clk_predivisor = DIV_ROUND_CLOSEST(
--
2.56.0
next prev parent reply other threads:[~2026-11-11 19:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 19:19 [PATCH 0/4] serial: vt8500: Clean up the probe Alexey Charkov
2026-11-11 19:19 ` [PATCH 1/4] serial: vt8500: Find console ports in the serial core state Alexey Charkov
2026-11-11 19:19 ` Alexey Charkov [this message]
2026-11-11 19:19 ` [PATCH 3/4] serial: vt8500: Handle uart_add_one_port() failure Alexey Charkov
2026-11-11 19:19 ` [PATCH 4/4] serial: vt8500: Drop the port index bitmap Alexey Charkov
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=20261111-vt8500-serial-cleanup-v1-2-b33594a25f87@gmail.com \
--to=alchark@gmail.com \
--cc=alan@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=gregkh@suse.de \
--cc=jirislaby@kernel.org \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@prisktech.co.nz \
--cc=vulab@iscas.ac.cn \
/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®