public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: Brian Masney <bmasney@redhat.com>,
	Michael Turquette <mturquette@baylibre.com>
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
	Brian Masney <bmasney@redhat.com>,
	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 Ker nel Team <kernel@pengutronix.de>
Subject: Re: [PATCH v2 01/12] clk: add new flag CLK_ROUNDING_NOOP
Date: Tue, 28 Apr 2026 19:15:36 -0700	[thread overview]
Message-ID: <177742893645.5403.3938693995862346406@localhost.localdomain> (raw)
In-Reply-To: <20260309-clk-det-rate-fw-managed-v2-1-c48ef5a3100a@redhat.com>

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.


  reply	other threads:[~2026-04-29  3:47 UTC|newest]

Thread overview: 10+ 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 [this message]
2026-04-29 13:55     ` Brian Masney
2026-03-09 14:38 ` [PATCH v2 04/12] clk: scpi: drop determine_rate op and use CLK_ROUNDING_NOOP flag 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-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=177742893645.5403.3938693995862346406@localhost.localdomain \
    --to=sboyd@kernel.org \
    --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=bmasney@redhat.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=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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox