Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Zhipeng.wang_1@oss.nxp.com
Cc: robh@kernel.org, devicetree@vger.kernel.org, imx@lists.linux.dev,
	conor+dt@kernel.org, Frank.Li@kernel.org
Subject: Re: [PATCH v5 3/3] clk: imx: imx8qxp: add soft dependency on SCU power domain driver
Date: Thu, 23 Jul 2026 02:20:25 +0000	[thread overview]
Message-ID: <20260723022025.C557B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260723020524.1886806-4-Zhipeng.wang_1@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Relying on MODULE_SOFTDEP for driver probe ordering is an anti-pattern that fails to guarantee resource availability and is completely ineffective in built-in/module configurations.
--

--- Patch [3]: [PATCH v5 3/3] clk: imx: imx8qxp: add soft dependency on SCU power domain driver ---
commit b23cf3ab8ab04f852f48d1fd72b4b4fa914a8cd0
Author: Zhipeng Wang <zhipeng.wang_1@nxp.com>

clk: imx: imx8qxp: add soft dependency on SCU power domain driver

This commit adds a MODULE_SOFTDEP to ensure the SCU power domain module
loads before the clock module. This is intended to work around failures
when attaching power domains to clock devices before the provider has
probed.

> diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c
> index c781425a005ef..17302ee628b76 100644
> --- a/drivers/clk/imx/clk-imx8qxp.c
> +++ b/drivers/clk/imx/clk-imx8qxp.c
> @@ -373,3 +373,4 @@ module_exit(imx8qxp_clk_exit);
>  MODULE_AUTHOR("Aisheng Dong <aisheng.dong@nxp.com>");
>  MODULE_DESCRIPTION("NXP i.MX8QXP clock driver");
>  MODULE_LICENSE("GPL v2");
> +MODULE_SOFTDEP("pre: scu_pd");

[Severity: High]
Does this softdep approach fully resolve the issue if one driver is built-in
and the other is a module?

Relying on module load ordering doesn't guarantee resource availability if
the kernel is configured with CONFIG_CLK_IMX8QXP=y and CONFIG_IMX_SCU_PD=m,
or if the power domain provider simply defers its probe. If the power
domains are not attached, the clocks are still registered and exposed.
Accessing them without an active power domain can lead to hardware hangs.

Looking at drivers/clk/imx/clk-scu.c, it appears the root of the problem is
that imx_clk_scu_alloc_dev() ignores the error instead of propagating it:

imx_clk_scu_alloc_dev()
    ...
    ret = imx_clk_scu_attach_pd(&pdev->dev, rsrc_id);
    if (ret)
        pr_warn("%s: failed to attached the power domain %d\n", name, ret);
    ...

Would it be safer to propagate the error (like -EPROBE_DEFER) when
imx_clk_scu_attach_pd() fails, rather than registering the clock hardware in
a broken state and relying on module load order?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260723020524.1886806-1-Zhipeng.wang_1@oss.nxp.com?part=3

  reply	other threads:[~2026-07-23  2:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23  2:05 [PATCH v5 0/3] pmdomain: imx: build the SCU power domain driver as a module Zhipeng.wang_1
2026-07-23  2:05 ` [PATCH v5 1/3] of: export of_stdout symbol Zhipeng.wang_1
2026-07-23  2:05 ` [PATCH v5 2/3] pmdomain: imx: scu-pd: allow building as a module Zhipeng.wang_1
2026-07-23  2:05 ` [PATCH v5 3/3] clk: imx: imx8qxp: add soft dependency on SCU power domain driver Zhipeng.wang_1
2026-07-23  2:20   ` sashiko-bot [this message]
2026-07-23  4:38     ` Zhipeng Wang (OSS)
2026-07-23 16:03   ` 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=20260723022025.C557B1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=Zhipeng.wang_1@oss.nxp.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox