mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Richard GENOUD <richard.genoud@bootlin.com>
To: Lei Liu <liulei.rjpt@vivo.com>
Cc: "Paul Cercueil" <paul@crapouillou.net>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Jiri Slaby" <jirislaby@kernel.org>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Jonathan Hunter" <jonathanh@nvidia.com>,
	"Kunihiko Hayashi" <hayashi.kunihiko@socionext.com>,
	"Masami Hiramatsu" <mhiramat@kernel.org>,
	"Nicolas Ferre" <nicolas.ferre@microchip.com>,
	"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
	"Claudiu Beznea" <claudiu.beznea@tuxon.dev>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Sudeep Holla" <sudeep.holla@arm.com>,
	"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Andreas Färber" <afaerber@suse.de>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Patrice Chotard" <patrice.chotard@foss.st.com>,
	"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
	"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Andi Shyti" <andi.shyti@linux.intel.com>,
	"Florian Fainelli" <florian.fainelli@broadcom.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"John Ogness" <john.ogness@linutronix.de>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Jeff Johnson" <quic_jjohnson@quicinc.com>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	"Valentin Caron" <valentin.caron@foss.st.com>,
	"Lino Sanfilippo" <l.sanfilippo@kunbus.com>,
	"Erwan Le Ray" <erwan.leray@foss.st.com>,
	linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-serial@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-actions@lists.infradead.org,
	linux-stm32@st-md-mailman.stormreply.com,
	opensource.kernel@vivo.com
Subject: Re: [PATCH 4/8] tty: atmel_serial: Use devm_clk_get_enabled() helpers
Date: Thu, 22 Aug 2024 15:28:40 +0200	[thread overview]
Message-ID: <c54434e3-1fb8-4491-b24f-2167786fe84c@bootlin.com> (raw)
In-Reply-To: <20240822033924.32397-5-liulei.rjpt@vivo.com>

Le 22/08/2024 à 05:39, Lei Liu a écrit :
> 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@vivo.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);
> -
Why removing this ?
This is not an error path.

>   	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;

Thanks,
Richard.


  reply	other threads:[~2024-08-22 13:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-22  3:39 [PATCH 0/8] tty serial drivers use " Lei Liu
2024-08-22  3:39 ` [PATCH 1/8] tty: 8250_ingenic: Use " Lei Liu
2024-08-22  9:40   ` Paul Cercueil
2024-08-22 13:24     ` Andy Shevchenko
2024-08-22 13:09   ` Andy Shevchenko
2024-08-22  3:39 ` [PATCH 2/8] tty: 8250_tegra: " Lei Liu
2024-08-22 13:10   ` Andy Shevchenko
2024-08-22  3:39 ` [PATCH 3/8] tty: 8250_uniphier: " Lei Liu
2024-08-22  3:39 ` [PATCH 4/8] tty: atmel_serial: " Lei Liu
2024-08-22 13:28   ` Richard GENOUD [this message]
2024-08-22 13:34     ` Andy Shevchenko
2024-08-22 14:33       ` Alexandre Belloni
2024-08-22  3:39 ` [PATCH 5/8] tty: mps2-uart: " Lei Liu
2024-08-22 13:19   ` Andy Shevchenko
2024-08-22 13:29     ` Lei Liu
2024-08-22  3:39 ` [PATCH 6/8] tty: owl-uart: " Lei Liu
2024-08-22  3:39 ` [PATCH 7/8] tty: st-asc: " Lei Liu
2024-08-22 13:21   ` Andy Shevchenko
2024-08-22  3:39 ` [PATCH 8/8] tty: stm32-usart: " Lei Liu
2024-08-22 13:23   ` Andy Shevchenko

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=c54434e3-1fb8-4491-b24f-2167786fe84c@bootlin.com \
    --to=richard.genoud@bootlin.com \
    --cc=afaerber@suse.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andi.shyti@linux.intel.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=erwan.leray@foss.st.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hayashi.kunihiko@socionext.com \
    --cc=jirislaby@kernel.org \
    --cc=john.ogness@linutronix.de \
    --cc=jonathanh@nvidia.com \
    --cc=l.sanfilippo@kunbus.com \
    --cc=linux-actions@lists.infradead.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux-tegra@vger.kernel.org \
    --cc=liulei.rjpt@vivo.com \
    --cc=liviu.dudau@arm.com \
    --cc=lpieralisi@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=mhiramat@kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=opensource.kernel@vivo.com \
    --cc=patrice.chotard@foss.st.com \
    --cc=paul@crapouillou.net \
    --cc=quic_jjohnson@quicinc.com \
    --cc=sudeep.holla@arm.com \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=valentin.caron@foss.st.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®