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>,
"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,
linux-serial@vger.kernel.org,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
linux-mips@vger.kernel.org,
"Patrice Chotard" <patrice.chotard@foss.st.com>,
"John Ogness" <john.ogness@linutronix.de>,
linux-kernel@vger.kernel.org, linux-actions@lists.infradead.org,
"Amelie Delaunay" <amelie.delaunay@foss.st.com>,
linux-tegra@vger.kernel.org,
"Thomas Gleixner" <tglx@linutronix.de>,
"Richard Genoud" <richard.genoud@bootlin.com>,
"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
"AngeloGioacchino Del Regno"
<angelogioacchino.delregno@collabora.com>,
"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 5/8] tty: mps2-uart: Use devm_clk_get_enabled() helpers
Date: Thu, 22 Aug 2024 16:19:31 +0300 [thread overview]
Message-ID: <Zsc645l_nFK_Xp-t@smile.fi.intel.com> (raw)
In-Reply-To: <20240822033924.32397-6-liulei.rjpt@vivo.com>
On Thu, Aug 22, 2024 at 11:39:09AM +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().
...
> - mps_port->clk = devm_clk_get(&pdev->dev, NULL);
> + mps_port->clk = devm_clk_get_enabled(&pdev->dev, NULL);
> if (IS_ERR(mps_port->clk))
> return PTR_ERR(mps_port->clk);
>
> - ret = clk_prepare_enable(mps_port->clk);
> - if (ret)
> - return ret;
> -
> mps_port->port.uartclk = clk_get_rate(mps_port->clk);
>
> - clk_disable_unprepare(mps_port->clk);
Your change is not equivalent. In case this clock is shared this may lead to
run-time issues. Hence I don't think this patch is needed in this case.
Instead, you may add a comment on top of devm_clk_get() to explain that we only
need it be enabled to get clock rate in the probe.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-08-22 13:20 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 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: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
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 [this message]
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=Zsc645l_nFK_Xp-t@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=amelie.delaunay@foss.st.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bigeasy@linutronix.de \
--cc=claudiu.beznea@tuxon.dev \
--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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).