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 v2 5/6] serial: vt8500: Use devm_clk_get_enabled()
Date: Thu, 12 Nov 2026 19:33:13 +0400 [thread overview]
Message-ID: <20261112-vt8500-serial-cleanup-v2-5-36b258e0c0dd@gmail.com> (raw)
In-Reply-To: <20261112-vt8500-serial-cleanup-v2-0-36b258e0c0dd@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 0c8ddd55f94d..cd5188282f64 100644
--- a/drivers/tty/serial/vt8500_serial.c
+++ b/drivers/tty/serial/vt8500_serial.c
@@ -586,7 +586,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;
@@ -606,18 +605,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 and enable 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-12 15:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-12 15:33 [PATCH v2 0/6] serial: vt8500: Clean up the probe using devm and new serial core helpers Alexey Charkov
2026-11-12 15:33 ` [PATCH v2 1/6] serial: core: Add uart_console_port() Alexey Charkov
2026-11-12 15:33 ` [PATCH v2 2/6] serial: core: Allocate a free line for UART_LINE_AUTO ports Alexey Charkov
2026-11-12 15:33 ` [PATCH v2 3/6] serial: vt8500: Look up console ports with uart_console_port() Alexey Charkov
2026-11-12 15:33 ` [PATCH v2 4/6] serial: vt8500: Drop the port index bitmap Alexey Charkov
2026-11-12 15:33 ` Alexey Charkov [this message]
2026-11-12 15:33 ` [PATCH v2 6/6] serial: vt8500: Handle uart_add_one_port() failure 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=20261112-vt8500-serial-cleanup-v2-5-36b258e0c0dd@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®