Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: Zhipeng.wang_1@oss.nxp.com
Cc: robh@kernel.org, conor+dt@kernel.org, Frank.Li@kernel.org,
	devicetree@vger.kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH v4 2/3] pmdomain: imx: scu-pd: allow building as a module
Date: Wed, 22 Jul 2026 08:38:09 +0000	[thread overview]
Message-ID: <20260722083809.7E8E61F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260722082522.3747962-3-Zhipeng.wang_1@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Converting the IMX_SCU_PD driver to a loadable module introduces a critical probe ordering race condition that permanently breaks SCU clock initialization.
--

--- Patch [2]: [PATCH v4 2/3] pmdomain: imx: scu-pd: allow building as a module ---
commit 628d94a1fc8f8e8847b2257f097c88ea5e22ffe7
Author: Zhipeng Wang <zhipeng.wang_1@nxp.com>

pmdomain: imx: scu-pd: allow building as a module

This commit converts the IMX SCU power domain driver to a tristate to
support Android GKI loadable modules. It relies on subsys_initcall() to
preserve probe ordering when built-in.

> diff --git a/drivers/pmdomain/imx/scu-pd.c b/drivers/pmdomain/imx/scu-pd.c
> index 3ec33667a308c..e3f9e741daf76 100644
> --- a/drivers/pmdomain/imx/scu-pd.c
> +++ b/drivers/pmdomain/imx/scu-pd.c
[ ... ]
> @@ -540,7 +541,12 @@ static struct platform_driver imx_sc_pd_driver = {
>  	},
>  	.probe = imx_sc_pd_probe,
>  };
> -builtin_platform_driver(imx_sc_pd_driver);
> +
> +static int __init imx_sc_pd_driver_init(void)
> +{
> +	return platform_driver_register(&imx_sc_pd_driver);
> +}
> +subsys_initcall(imx_sc_pd_driver_init);

[Severity: High]
Does converting this driver to a loadable module break the probe ordering
with the SCU clock driver?

Because subsys_initcall() behaves like module_init() when built as a module,
the power domain and clock modules will be loaded asynchronously by udev.

If the clock provider probes before the power domain module is loaded,
it fails to attach the power domain but proceeds to register the clocks
anyway:

drivers/clk/imx/clk-scu.c: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);

        ret = platform_device_add(pdev);
        ...
}

Since there is no fw_devlink dependency (the clock controller DT node
lacks a power-domains property) and no symbol dependency, the clock
driver will not defer its probe. This leaves the SCU clocks without
their required power domains, which causes hardware faults when the
clocks are later enabled.

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

  reply	other threads:[~2026-07-22  8:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-22  8:25 [PATCH v4 0/3] pmdomain: imx: build the SCU power domain driver as a module Zhipeng.wang_1
2026-07-22  8:25 ` [PATCH v4 1/3] of: export of_stdout symbol Zhipeng.wang_1
2026-07-22  8:25 ` [PATCH v4 2/3] pmdomain: imx: scu-pd: allow building as a module Zhipeng.wang_1
2026-07-22  8:38   ` sashiko-bot [this message]
2026-07-22  8:25 ` [PATCH v4 3/3] clk: imx: imx8qxp: add soft dependency on SCU power domain driver Zhipeng.wang_1
2026-07-22  8:35   ` 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=20260722083809.7E8E61F000E9@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