[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240822033924.32397-7-liulei.rjpt@vivo.com>
Date: Thu, 22 Aug 2024 11:39:10 +0800
From: Lei Liu <liulei.rjpt@...o.com>
To: Paul Cercueil <paul@...pouillou.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Kunihiko Hayashi <hayashi.kunihiko@...ionext.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Richard Genoud <richard.genoud@...tlin.com>,
Nicolas Ferre <nicolas.ferre@...rochip.com>,
Alexandre Belloni <alexandre.belloni@...tlin.com>,
Claudiu Beznea <claudiu.beznea@...on.dev>,
Liviu Dudau <liviu.dudau@....com>,
Sudeep Holla <sudeep.holla@....com>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Andreas Färber <afaerber@...e.de>,
Manivannan Sadhasivam <manivannan.sadhasivam@...aro.org>,
Patrice Chotard <patrice.chotard@...s.st.com>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
Andi Shyti <andi.shyti@...ux.intel.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Florian Fainelli <florian.fainelli@...adcom.com>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
Lei Liu <liulei.rjpt@...o.com>,
John Ogness <john.ogness@...utronix.de>,
Thomas Gleixner <tglx@...utronix.de>,
Jeff Johnson <quic_jjohnson@...cinc.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Valentin Caron <valentin.caron@...s.st.com>,
Lino Sanfilippo <l.sanfilippo@...bus.com>,
Amelie Delaunay <amelie.delaunay@...s.st.com>,
linux-mips@...r.kernel.org,
linux-kernel@...r.kernel.org,
linux-serial@...r.kernel.org,
linux-tegra@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org,
linux-actions@...ts.infradead.org,
linux-stm32@...md-mailman.stormreply.com
Cc: opensource.kernel@...o.com
Subject: [PATCH 6/8] tty: owl-uart: Use devm_clk_get_enabled() helpers
The devm_clk_get_enabled() helpers:
- call devm_clk_get()
- call clk_prepare_enable() and register what is needed in order to
call clk_disable_unprepare() when needed, as a managed resource.
This simplifies the code and avoids calls to clk_disable_unprepare().
Signed-off-by: Lei Liu <liulei.rjpt@...o.com>
---
drivers/tty/serial/owl-uart.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/tty/serial/owl-uart.c b/drivers/tty/serial/owl-uart.c
index ecec483d4d59..28c33cea6b41 100644
--- a/drivers/tty/serial/owl-uart.c
+++ b/drivers/tty/serial/owl-uart.c
@@ -680,18 +680,12 @@ static int owl_uart_probe(struct platform_device *pdev)
if (!owl_port)
return -ENOMEM;
- owl_port->clk = devm_clk_get(&pdev->dev, NULL);
+ owl_port->clk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(owl_port->clk)) {
dev_err(&pdev->dev, "could not get clk\n");
return PTR_ERR(owl_port->clk);
}
- ret = clk_prepare_enable(owl_port->clk);
- if (ret) {
- dev_err(&pdev->dev, "could not enable clk\n");
- return ret;
- }
-
owl_port->port.dev = &pdev->dev;
owl_port->port.line = pdev->id;
owl_port->port.type = PORT_OWL;
@@ -701,7 +695,6 @@ static int owl_uart_probe(struct platform_device *pdev)
owl_port->port.uartclk = clk_get_rate(owl_port->clk);
if (owl_port->port.uartclk == 0) {
dev_err(&pdev->dev, "clock rate is zero\n");
- clk_disable_unprepare(owl_port->clk);
return -EINVAL;
}
owl_port->port.flags = UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_LOW_LATENCY;
@@ -725,7 +718,6 @@ static void owl_uart_remove(struct platform_device *pdev)
uart_remove_one_port(&owl_uart_driver, &owl_port->port);
owl_uart_ports[pdev->id] = NULL;
- clk_disable_unprepare(owl_port->clk);
}
static struct platform_driver owl_uart_platform_driver = {
--
2.34.1
Powered by blists - more mailing lists