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-5-liulei.rjpt@vivo.com>
Date: Thu, 22 Aug 2024 11:39:08 +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>,
	Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
	Andi Shyti <andi.shyti@...ux.intel.com>,
	Florian Fainelli <florian.fainelli@...adcom.com>,
	Lei Liu <liulei.rjpt@...o.com>,
	Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
	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>,
	Erwan Le Ray <erwan.leray@...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 4/8] tty: atmel_serial: 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/atmel_serial.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/tty/serial/atmel_serial.c b/drivers/tty/serial/atmel_serial.c
index 09b246c9e389..209f3d41a17c 100644
--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -2910,14 +2910,11 @@ static int atmel_serial_probe(struct platform_device *pdev)
 	atomic_set(&atmel_port->tasklet_shutdown, 0);
 	spin_lock_init(&atmel_port->lock_suspended);
 
-	atmel_port->clk = devm_clk_get(&pdev->dev, "usart");
+	atmel_port->clk = devm_clk_get_enabled(&pdev->dev, "usart");
 	if (IS_ERR(atmel_port->clk)) {
 		ret = PTR_ERR(atmel_port->clk);
 		goto err;
 	}
-	ret = clk_prepare_enable(atmel_port->clk);
-	if (ret)
-		goto err;
 
 	atmel_port->gclk = devm_clk_get_optional(&pdev->dev, "gclk");
 	if (IS_ERR(atmel_port->gclk)) {
@@ -2968,15 +2965,12 @@ static int atmel_serial_probe(struct platform_device *pdev)
 	 * The peripheral clock can now safely be disabled till the port
 	 * is used
 	 */
-	clk_disable_unprepare(atmel_port->clk);
-
 	return 0;
 
 err_add_port:
 	kfree(atmel_port->rx_ring.buf);
 	atmel_port->rx_ring.buf = NULL;
 err_clk_disable_unprepare:
-	clk_disable_unprepare(atmel_port->clk);
 	clear_bit(atmel_port->uart.line, atmel_ports_in_use);
 err:
 	return ret;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ