lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240822033924.32397-3-liulei.rjpt@vivo.com>
Date: Thu, 22 Aug 2024 11:39:06 +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>,
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
	Florian Fainelli <florian.fainelli@...adcom.com>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
	Lei Liu <liulei.rjpt@...o.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	John Ogness <john.ogness@...utronix.de>,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	Jeff Johnson <quic_jjohnson@...cinc.com>,
	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 2/8] 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().

Signed-off-by: Lei Liu <liulei.rjpt@...o.com>
---
 drivers/tty/serial/8250/8250_tegra.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_tegra.c b/drivers/tty/serial/8250/8250_tegra.c
index 60a80d00d251..a38a4eb3235b 100644
--- a/drivers/tty/serial/8250/8250_tegra.c
+++ b/drivers/tty/serial/8250/8250_tegra.c
@@ -86,16 +86,12 @@ 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);
 	}
 
@@ -115,7 +111,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 +121,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

Powered by Openwall GNU/*/Linux Powered by OpenVZ