All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Peng Fan (OSS)" <peng.fan@oss.nxp.com>
Cc: devicetree@vger.kernel.org, linux-clk@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v11 2/6] clk: Introduce clk_hw_set_spread_spectrum
Date: Mon, 17 Aug 2026 11:04:28 +0000	[thread overview]
Message-ID: <20260817110428.BC6B41F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260817-clk-v11-v11-2-36e9bc701b11@nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The clock's PM domain is unconditionally resumed before checking if the `set_spread_spectrum` callback is supported, causing an unnecessary hardware wakeup.
--

--- Patch [2]: [PATCH v11 2/6] clk: Introduce clk_hw_set_spread_spectrum ---
commit f5617081c24679334412209893c7d5c3a6321d1f
Author: Peng Fan <peng.fan@nxp.com>

clk: Introduce clk_hw_set_spread_spectrum

This commit introduces the clk_hw_set_spread_spectrum API to allow clock
drivers to configure spread spectrum features. It adds a set_spread_spectrum
callback to clk_ops for hardware-specific implementations.

> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 048adfa86a5d0..8c78621cde253 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c

[ ... ]

> @@ -2774,6 +2774,33 @@ int clk_set_max_rate(struct clk *clk, unsigned long rate)
>  }
>  EXPORT_SYMBOL_GPL(clk_set_max_rate);
>  
> +int clk_hw_set_spread_spectrum(struct clk_hw *hw, const struct clk_spread_spectrum *ss_conf)
> +{
> +	struct clk_core *core;
> +	int ret;
> +
> +	if (!hw)
> +		return 0;
> +
> +	core = hw->core;
> +
> +	clk_prepare_lock();
> +
> +	ret = clk_pm_runtime_get(core);
> +	if (ret)
> +		goto fail;
> +
> +	if (core->ops->set_spread_spectrum)
> +		ret = core->ops->set_spread_spectrum(hw, ss_conf);

[Severity: Medium]
Is it necessary to wake up the device via PM runtime before verifying that
the set_spread_spectrum callback is supported? Waking up the device might
involve slow hardware communication or powering up a PM domain.

Also, if the callback is not populated, ret will remain 0 from the
successful clk_pm_runtime_get call. Does this mean the function will return
success when it actually failed to set the spread spectrum, instead of
returning an error like -EOPNOTSUPP?

> +
> +	clk_pm_runtime_put(core);
> +
> +fail:
> +	clk_prepare_unlock();
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(clk_hw_set_spread_spectrum);
> +

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260817-clk-v11-v11-0-36e9bc701b11@nxp.com?part=2

  reply	other threads:[~2026-08-17 11:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 10:59 [PATCH v11 0/6] clk: Support spread spectrum and use it in clk-scmi Peng Fan (OSS)
2026-08-17 10:59 ` [PATCH v11 1/6] dt-bindings: clock: Add spread spectrum definition Peng Fan (OSS)
2026-08-17 10:59 ` [PATCH v11 2/6] clk: Introduce clk_hw_set_spread_spectrum Peng Fan (OSS)
2026-08-17 11:04   ` sashiko-bot [this message]
2026-08-17 10:59 ` [PATCH v11 3/6] clk: conf: Support assigned-clock-sscs Peng Fan (OSS)
2026-08-17 11:04   ` sashiko-bot
2026-08-17 10:59 ` [PATCH v11 4/6] clk: Add KUnit tests for assigned-clock-sscs Peng Fan (OSS)
2026-08-17 11:07   ` sashiko-bot
2026-08-17 10:59 ` [PATCH v11 5/6] clk: scmi: Introduce common header for SCMI clock interface Peng Fan (OSS)
2026-08-17 11:08   ` sashiko-bot
2026-08-17 10:59 ` [PATCH v11 6/6] clk: scmi: Add i.MX95 OEM extension support for SCMI clock driver Peng Fan (OSS)
2026-08-17 11:16   ` sashiko-bot

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=20260817110428.BC6B41F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=peng.fan@oss.nxp.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.