[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240826113231.7300-1-liulei.rjpt@vivo.com>
Date: Mon, 26 Aug 2024 19:32:28 +0800
From: Lei Liu <liulei.rjpt@...o.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>,
Lei Liu <liulei.rjpt@...o.com>,
AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Geert Uytterhoeven <geert+renesas@...der.be>,
Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
linux-kernel@...r.kernel.org,
linux-serial@...r.kernel.org,
linux-tegra@...r.kernel.org
Cc: opensource.kernel@...o.com
Subject: [PATCH v2 2/5] tty: 8250_tegra: 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().
---
v1->V2 changes
1.Remove redundant label err_clkdisable from 8250_tegra
Signed-off-by: Lei Liu <liulei.rjpt@...o.com>
---
drivers/tty/serial/8250/8250_tegra.c | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_tegra.c b/drivers/tty/serial/8250/8250_tegra.c
index 60a80d00d251..79e5765a10f0 100644
--- a/drivers/tty/serial/8250/8250_tegra.c
+++ b/drivers/tty/serial/8250/8250_tegra.c
@@ -86,22 +86,18 @@ static int tegra_uart_probe(struct platform_device *pdev)
return PTR_ERR(uart->rst);
if (!port->uartclk) {
- uart->clk = devm_clk_get(&pdev->dev, NULL);
+ uart->clk = devm_clk_get_enabled(&pdev->dev, NULL);
if (IS_ERR(uart->clk)) {
dev_err(&pdev->dev, "failed to get clock!\n");
return -ENODEV;
}
- ret = clk_prepare_enable(uart->clk);
- if (ret < 0)
- return ret;
-
port->uartclk = clk_get_rate(uart->clk);
}
ret = reset_control_deassert(uart->rst);
if (ret)
- goto err_clkdisable;
+ return ret;
ret = serial8250_register_8250_port(&port8250);
if (ret < 0)
@@ -114,9 +110,6 @@ static int tegra_uart_probe(struct platform_device *pdev)
err_ctrl_assert:
reset_control_assert(uart->rst);
-err_clkdisable:
- clk_disable_unprepare(uart->clk);
-
return ret;
}
@@ -126,7 +119,6 @@ static void tegra_uart_remove(struct platform_device *pdev)
serial8250_unregister_port(uart->line);
reset_control_assert(uart->rst);
- clk_disable_unprepare(uart->clk);
}
#ifdef CONFIG_PM_SLEEP
--
2.34.1
Powered by blists - more mailing lists