Re: [PATCH v3 2/2] pmdomain: imx: scu-pd: allow building as a module

[email protected]
Newsgroups dev.linux.lists.imx,org.kernel.vger.linux-devicetree
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Building the SCU PM domain driver as a module breaks power domain attachment for SCU clocks due to unhandled deferred probing.
--

--- Patch [2]: [PATCH v3 2/2] pmdomain: imx: scu-pd: allow building as a module ---
commit 8b0026aca4b6a877c269d6333189db725f3c6d76
Author: Zhipeng Wang <[email protected]>

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

This commit converts the IMX_SCU_PD config from bool to tristate to allow
building the SCU power domain driver as a loadable module, which is
required for Android GKI kernels.

> diff --git a/drivers/pmdomain/imx/Kconfig b/drivers/pmdomain/imx/Kconfig
> index 00203615c65e9..472e9dec6bd4e 100644
> --- a/drivers/pmdomain/imx/Kconfig
> +++ b/drivers/pmdomain/imx/Kconfig
> @@ -21,7 +21,7 @@ config IMX9_BLK_CTRL
>  	depends on PM_GENERIC_DOMAINS
>  
>  config IMX_SCU_PD
> -	bool "IMX SCU Power Domain driver"
> +	tristate "IMX SCU Power Domain driver"

[Severity: High]
Does building the power domain driver as a module break power domain
attachment for SCU clocks?

If IMX_SCU_PD is built as a module, there are no explicit symbol dependencies
or softdeps between the SCU clock driver and the PD provider, meaning the
clock driver might be loaded first.

Looking at the consumer side in 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 the consumer ignores the return value from the attachment attempt, an
error like -ENOENT (when the provider is not registered yet) will not
trigger a deferred probe. Furthermore, because these software-created clock
devices lack an of_node, the device core's standard deferred probing
mechanisms cannot retry the attachment later.

Will this leave the SCU clocks permanently registered without their power
domains attached, potentially causing hardware malfunctions or continuous
power waste?

>  	depends on IMX_SCU
>  	help
>  	  The System Controller Firmware (SCFW) based power domain driver.

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.