All of lore.kernel.org
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: cip-dev@lists.cip-project.org,
	Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>,
	Pavel Machek <pavel@denx.de>
Cc: Chris Paterson <chris.paterson2@renesas.com>,
	Biju Das <biju.das.jz@bp.renesas.com>,
	Fabrizio Castro <fabrizio.castro.jz@renesas.com>
Subject: [PATCH 6.1.y-cip 4/7] serial: 8250_em: Use devm_clk_get_enabled()
Date: Tue, 13 Jun 2023 14:26:17 +0100	[thread overview]
Message-ID: <20230613132620.150832-5-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20230613132620.150832-1-biju.das.jz@bp.renesas.com>

commit 7eada8a122a2683ec63ad43982a4552b054d59ca upstream.

Simplify clk handling in probe() by replacing devm_clk_get()->devm_
clk_get_enabled(). This replaces the usage of clk_prepare_enable/clk_
disable_unprepare() in probe()/remove(). After that sclk is no
longer required in struct serial8250_em_priv and is replaced by a
local variable sclk in probe().

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
Link: https://lore.kernel.org/r/20230227114152.22265-6-biju.das.jz@bp.renesas.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
 drivers/tty/serial/8250/8250_em.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_em.c b/drivers/tty/serial/8250/8250_em.c
index 621abca93694..dcf1761e8ef5 100644
--- a/drivers/tty/serial/8250/8250_em.c
+++ b/drivers/tty/serial/8250/8250_em.c
@@ -20,7 +20,6 @@
 #define UART_DLM_EM 10
 
 struct serial8250_em_priv {
-	struct clk *sclk;
 	int line;
 };
 
@@ -82,6 +81,7 @@ static int serial8250_em_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct uart_8250_port up;
 	struct resource *regs;
+	struct clk *sclk;
 	int irq, ret;
 
 	irq = platform_get_irq(pdev, 0);
@@ -96,9 +96,9 @@ static int serial8250_em_probe(struct platform_device *pdev)
 	if (!priv)
 		return -ENOMEM;
 
-	priv->sclk = devm_clk_get(dev, "sclk");
-	if (IS_ERR(priv->sclk))
-		return dev_err_probe(dev, PTR_ERR(priv->sclk), "unable to get clock\n");
+	sclk = devm_clk_get_enabled(dev, "sclk");
+	if (IS_ERR(sclk))
+		return dev_err_probe(dev, PTR_ERR(sclk), "unable to get clock\n");
 
 	memset(&up, 0, sizeof(up));
 	up.port.mapbase = regs->start;
@@ -108,8 +108,7 @@ static int serial8250_em_probe(struct platform_device *pdev)
 	up.port.dev = dev;
 	up.port.private_data = priv;
 
-	clk_prepare_enable(priv->sclk);
-	up.port.uartclk = clk_get_rate(priv->sclk);
+	up.port.uartclk = clk_get_rate(sclk);
 
 	up.port.iotype = UPIO_MEM32;
 	up.port.serial_in = serial8250_em_serial_in;
@@ -118,10 +117,8 @@ static int serial8250_em_probe(struct platform_device *pdev)
 	up.dl_write = serial8250_em_serial_dl_write;
 
 	ret = serial8250_register_8250_port(&up);
-	if (ret < 0) {
-		clk_disable_unprepare(priv->sclk);
+	if (ret < 0)
 		return dev_err_probe(dev, ret, "unable to register 8250 port\n");
-	}
 
 	priv->line = ret;
 	platform_set_drvdata(pdev, priv);
@@ -133,7 +130,6 @@ static int serial8250_em_remove(struct platform_device *pdev)
 	struct serial8250_em_priv *priv = platform_get_drvdata(pdev);
 
 	serial8250_unregister_port(priv->line);
-	clk_disable_unprepare(priv->sclk);
 	return 0;
 }
 
-- 
2.25.1



  parent reply	other threads:[~2023-06-13 13:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-13 13:26 [PATCH 6.1.y-cip 0/7] RZ/V2M UART FIFO support Biju Das
2023-06-13 13:26 ` [PATCH 6.1.y-cip 1/7] serial: 8250_em: Simplify probe() Biju Das
2023-06-13 13:26 ` [PATCH 6.1.y-cip 2/7] serial: 8250_em: Drop unused header file Biju Das
2023-06-13 13:26 ` [PATCH 6.1.y-cip 3/7] serial: 8250_em: Add missing break statement Biju Das
2023-06-13 13:26 ` Biju Das [this message]
2023-06-13 13:26 ` [PATCH 6.1.y-cip 5/7] serial: 8250_em: Use pseudo offset for UART_FCR Biju Das
2023-06-13 13:26 ` [PATCH 6.1.y-cip 6/7] serial: 8250_em: Add serial8250_em_{reg_update(),out_helper()} Biju Das
2023-06-13 13:26 ` [PATCH 6.1.y-cip 7/7] arm64: dts: renesas: rzv2mevk2: Add uart0 pins Biju Das
2023-06-14  0:40 ` [PATCH 6.1.y-cip 0/7] RZ/V2M UART FIFO support nobuhiro1.iwamatsu
2023-06-15  8:35   ` Pavel Machek

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=20230613132620.150832-5-biju.das.jz@bp.renesas.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=chris.paterson2@renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    --cc=fabrizio.castro.jz@renesas.com \
    --cc=nobuhiro1.iwamatsu@toshiba.co.jp \
    --cc=pavel@denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.