From: Andy Shevchenko <andriy.shevchenko@linux.intel.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>,
"Richard Genoud" <richard.genoud@bootlin.com>,
"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>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Andi Shyti" <andi.shyti@linux.intel.com>,
"John Ogness" <john.ogness@linutronix.de>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Jeff Johnson" <quic_jjohnson@quicinc.com>,
"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 7/8] tty: st-asc: Use devm_clk_get_enabled() helpers
Date: Thu, 22 Aug 2024 16:21:54 +0300 [thread overview]
Message-ID: <Zsc7chKkKMZLs-bZ@smile.fi.intel.com> (raw)
In-Reply-To: <20240822033924.32397-8-liulei.rjpt@vivo.com>
On Thu, Aug 22, 2024 at 11:39:11AM +0800, Lei Liu wrote:
> 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().
...
Same caveat as in another patch comment.
> - ascport->clk = devm_clk_get(&pdev->dev, NULL);
> + ascport->clk = devm_clk_get_enabled(&pdev->dev, NULL);
>
> if (WARN_ON(IS_ERR(ascport->clk)))
> return -EINVAL;
> - /* ensure that clk rate is correct by enabling the clk */
> - ret = clk_prepare_enable(ascport->clk);
> - if (ret)
> - return ret;
> +
> ascport->port.uartclk = clk_get_rate(ascport->clk);
> WARN_ON(ascport->port.uartclk == 0);
Btw, not related to this series, you may try to get rid of these 0 checks as
the serial core has this and it will fail anyway. Perhaps you want to expand
serial core to issue an error message (if it's not done yet).
> - clk_disable_unprepare(ascport->clk);
--
With Best Regards,
Andy Shevchenko
WARNING: multiple messages have this Message-ID (diff)
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Lei Liu <liulei.rjpt@vivo.com>
Cc: "Alexandre Belloni" <alexandre.belloni@bootlin.com>,
"Valentin Caron" <valentin.caron@foss.st.com>,
"Erwan Le Ray" <erwan.leray@foss.st.com>,
"Geert Uytterhoeven" <geert+renesas@glider.be>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Liviu Dudau" <liviu.dudau@arm.com>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
"Claudiu Beznea" <claudiu.beznea@tuxon.dev>,
"Paul Cercueil" <paul@crapouillou.net>,
"Thierry Reding" <thierry.reding@gmail.com>,
"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
"Jiri Slaby" <jirislaby@kernel.org>,
linux-stm32@st-md-mailman.stormreply.com,
opensource.kernel@vivo.com,
"Kunihiko Hayashi" <hayashi.kunihiko@socionext.com>,
"Jonathan Hunter" <jonathanh@nvidia.com>,
linux-arm-kernel@lists.infradead.org,
"Andi Shyti" <andi.shyti@linux.intel.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
linux-mips@vger.kernel.org,
"Patrice Chotard" <patrice.chotard@foss.st.com>,
linux-serial@vger.kernel.org,
"John Ogness" <john.ogness@linutronix.de>,
linux-kernel@vger.kernel.org, linux-actions@lists.infradead.org,
linux-tegra@vger.kernel.org,
"Thomas Gleixner" <tglx@linutronix.de>,
"Richard Genoud" <richard.genoud@bootlin.com>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
"Lino Sanfilippo" <l.sanfilippo@kunbus.com>,
"Masami Hiramatsu" <mhiramat@kernel.org>,
"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
"Sudeep Holla" <sudeep.holla@arm.com>,
"Jeff Johnson" <quic_jjohnson@quicinc.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: Re: [PATCH 7/8] tty: st-asc: Use devm_clk_get_enabled() helpers
Date: Thu, 22 Aug 2024 16:21:54 +0300 [thread overview]
Message-ID: <Zsc7chKkKMZLs-bZ@smile.fi.intel.com> (raw)
In-Reply-To: <20240822033924.32397-8-liulei.rjpt@vivo.com>
On Thu, Aug 22, 2024 at 11:39:11AM +0800, Lei Liu wrote:
> 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().
...
Same caveat as in another patch comment.
> - ascport->clk = devm_clk_get(&pdev->dev, NULL);
> + ascport->clk = devm_clk_get_enabled(&pdev->dev, NULL);
>
> if (WARN_ON(IS_ERR(ascport->clk)))
> return -EINVAL;
> - /* ensure that clk rate is correct by enabling the clk */
> - ret = clk_prepare_enable(ascport->clk);
> - if (ret)
> - return ret;
> +
> ascport->port.uartclk = clk_get_rate(ascport->clk);
> WARN_ON(ascport->port.uartclk == 0);
Btw, not related to this series, you may try to get rid of these 0 checks as
the serial core has this and it will fail anyway. Perhaps you want to expand
serial core to issue an error message (if it's not done yet).
> - clk_disable_unprepare(ascport->clk);
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-08-22 13:22 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-22 3:39 [PATCH 0/8] tty serial drivers use devm_clk_get_enabled() helpers 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:24 ` Andy Shevchenko
2024-08-22 13:09 ` 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 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
2024-08-22 13:28 ` Richard GENOUD
2024-08-22 13:34 ` Andy Shevchenko
2024-08-22 13:34 ` Andy Shevchenko
2024-08-22 14:33 ` Alexandre Belloni
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:19 ` Andy Shevchenko
2024-08-22 13:29 ` Lei Liu
2024-08-22 13:29 ` Lei Liu
2024-08-22 17:20 ` kernel test robot
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 [this message]
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
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=Zsc7chKkKMZLs-bZ@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=afaerber@suse.de \
--cc=alexandre.belloni@bootlin.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andi.shyti@linux.intel.com \
--cc=bigeasy@linutronix.de \
--cc=claudiu.beznea@tuxon.dev \
--cc=erwan.leray@foss.st.com \
--cc=geert+renesas@glider.be \
--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=richard.genoud@bootlin.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 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.