From: Brian Masney <bmasney@redhat.com>
To: Stephen Boyd <sboyd@kernel.org>
Cc: Michael Turquette <mturquette@baylibre.com>,
linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
Sudeep Holla <sudeep.holla@kernel.org>,
Abel Vesa <abelvesa@kernel.org>,
Andrea della Porta <andrea.porta@suse.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Bjorn Andersson <andersson@kernel.org>,
Chanwoo Choi <cw00.choi@samsung.com>, Frank Li <Frank.Li@nxp.com>,
Geert Uytterhoeven <geert+renesas@glider.be>,
Krzysztof Kozlowski <krzk@kernel.org>,
Orson Zhai <orsonzhai@gmail.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Tudor Ambarus <tudor.ambarus@linaro.org>,
Alim Akhtar <alim.akhtar@samsung.com>,
arm-scmi@vger.kernel.org, Chunyan Zhang <zhang.lyra@gmail.com>,
Cristian Marussi <cristian.marussi@arm.com>,
Fabio Estevam <festevam@gmail.com>,
imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org,
linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
linux-samsung-soc@vger.kernel.org, Peng Fan <peng.fan@nxp.com>,
Pengutronix Kernel Team <kernel@pengutronix.de>
Subject: Re: [PATCH v2 01/12] clk: add new flag CLK_ROUNDING_NOOP
Date: Wed, 29 Apr 2026 09:55:39 -0400 [thread overview]
Message-ID: <afIN2y_PCGofGAKD@redhat.com> (raw)
In-Reply-To: <177742893645.5403.3938693995862346406@localhost.localdomain>
On Tue, Apr 28, 2026 at 07:15:36PM -0700, Stephen Boyd wrote:
> Quoting Brian Masney (2026-03-09 07:38:40)
> > diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> > index fd418dc988b1c60c49e3ac9c0c44aa132dd5da28..1187e5b1dbc123d2d2c1f43690d7dcf75a7c4ac3 100644
> > --- a/drivers/clk/clk.c
> > +++ b/drivers/clk/clk.c
> > @@ -1673,7 +1690,7 @@ EXPORT_SYMBOL_GPL(clk_hw_forward_rate_request);
> >
> > static bool clk_core_can_round(struct clk_core * const core)
> > {
> > - return core->ops->determine_rate;
> > + return core->ops->determine_rate || clk_is_rounding_noop(core);
> > }
> >
> > static int clk_core_round_rate_nolock(struct clk_core *core,
> > @@ -3528,6 +3545,7 @@ static const struct {
> > ENTRY(CLK_IS_CRITICAL),
> > ENTRY(CLK_OPS_PARENT_ENABLE),
> > ENTRY(CLK_DUTY_CYCLE_PARENT),
> > + ENTRY(CLK_ROUNDING_NOOP),
> > #undef ENTRY
> > };
> >
> > @@ -3906,13 +3924,19 @@ static int __clk_core_init(struct clk_core *core)
> >
> > /* check that clk_ops are sane. See Documentation/driver-api/clk.rst */
> > if (core->ops->set_rate && !core->ops->determine_rate &&
> > - core->ops->recalc_rate) {
> > + core->ops->recalc_rate && !clk_is_rounding_noop(core)) {
> > pr_err("%s: %s must implement .determine_rate in addition to .recalc_rate\n",
> > __func__, core->name);
> > ret = -EINVAL;
> > goto out;
> > }
> >
> > + if (clk_is_rounding_noop(core) && core->ops->determine_rate) {
> > + pr_err("%s: %s cannot implement both .determine_rate and CLK_ROUNDING_NOOP\n",
> > + __func__, core->name);
> > + goto out;
> > + }
> > +
>
> This hunk has me irked. I'd rather we export some function like
> clk_determine_rate_noop() that just returns 0 instead of adding another
> flag. The chance that someone can get it wrong goes down and you can
> naturally grep for any clks that are using determine_rate() without
> having to also include this flag in the grep. It makes it easier to
> reason about as well because we can have code that just checks for
> determine_rate presence instead of both (i.e. clk_core_can_round() isn't
> changed). Plus a clk_ops structure is more self-contained because it
> doesn't rely on the clk flags to go with it.
I also like the clk_determine_rate_noop() approach much better as well.
I'll send a new version.
Thanks,
Brian
next prev parent reply other threads:[~2026-04-29 13:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 14:38 [PATCH v2 00/12] clk: add new flag CLK_ROUNDING_NOOP Brian Masney
2026-03-09 14:38 ` [PATCH v2 01/12] " Brian Masney
2026-04-29 2:15 ` Stephen Boyd
2026-04-29 2:15 ` Stephen Boyd
2026-04-29 13:55 ` Brian Masney [this message]
2026-03-09 14:38 ` [PATCH v2 02/12] clk: test: add test suite for CLK_ROUNDING_NOOP flag Brian Masney
2026-03-09 14:38 ` [PATCH v2 03/12] clk: rp1: drop determine_rate op and use " Brian Masney
2026-03-09 14:38 ` [PATCH v2 04/12] clk: scpi: " Brian Masney
2026-03-09 14:38 ` [PATCH v2 05/12] clk: hisilicon: hi3660-stub: " Brian Masney
2026-03-09 14:38 ` [PATCH v2 06/12] clk: imx: scu: drop redundant init.ops variable assignment Brian Masney
2026-03-09 14:38 ` [PATCH v2 07/12] clk: imx: scu: drop determine_rate op and use CLK_ROUNDING_NOOP flag Brian Masney
2026-03-09 14:38 ` [PATCH v2 08/12] clk: qcom: rpm: " Brian Masney
2026-03-09 14:38 ` [PATCH v2 09/12] clk: qcom: rpmh: " Brian Masney
2026-03-09 14:38 ` [PATCH v2 10/12] clk: qcom: smd-rpm: " Brian Masney
2026-03-10 10:17 ` Konrad Dybcio
2026-03-10 10:36 ` Brian Masney
2026-03-10 10:51 ` Konrad Dybcio
2026-03-09 14:38 ` [PATCH v2 11/12] clk: samsung: acpm: " Brian Masney
2026-03-11 11:52 ` Tudor Ambarus
2026-03-09 14:38 ` [PATCH v2 12/12] clk: sprd: " Brian Masney
2026-03-11 11:50 ` [PATCH v2 00/12] clk: add new flag CLK_ROUNDING_NOOP Tudor Ambarus
2026-03-11 13:01 ` Brian Masney
2026-04-28 20:38 ` Brian Masney
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=afIN2y_PCGofGAKD@redhat.com \
--to=bmasney@redhat.com \
--cc=Frank.Li@nxp.com \
--cc=abelvesa@kernel.org \
--cc=alim.akhtar@samsung.com \
--cc=andersson@kernel.org \
--cc=andrea.porta@suse.com \
--cc=arm-scmi@vger.kernel.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=cristian.marussi@arm.com \
--cc=cw00.choi@samsung.com \
--cc=festevam@gmail.com \
--cc=geert+renesas@glider.be \
--cc=imx@lists.linux.dev \
--cc=kernel@pengutronix.de \
--cc=krzk@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=orsonzhai@gmail.com \
--cc=peng.fan@nxp.com \
--cc=s.hauer@pengutronix.de \
--cc=s.nawrocki@samsung.com \
--cc=sboyd@kernel.org \
--cc=sudeep.holla@kernel.org \
--cc=tudor.ambarus@linaro.org \
--cc=zhang.lyra@gmail.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.