Re: [PATCH] drivers/mfd: Convert to DEFINE_SIMPLE_DEV_PM_OPS()

[email protected]
Newsgroups dev.linux.lists.mfd
Message-ID <[email protected]>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Low] The commit message prefix uses 'drivers/mfd:' instead of the required 'mfd: ' format.

Pre-existing issues:
- [High] Device teardown sequence disables PM runtime and clocks before unregistering MFD child devices, leading to an external abort kernel panic.
--

--- Patch [1]: [PATCH] drivers/mfd: Convert to DEFINE_SIMPLE_DEV_PM_OPS() ---
commit f2c525c2ee807012f8f33d16a4bcbea747e75dcf
Author: Triet Hoang <[email protected]>

    drivers/mfd: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
    
    Convert the deprecated SIMPLE_DEV_PM_OPS
    to DEFINE_SIMPLE_DEV_PM_OPS
    and pm_sleep_ptr().

>     drivers/mfd: Convert to DEFINE_SIMPLE_DEV_PM_OPS()

[Severity: Low]
This isn't a bug, but does this commit title violate the MFD subsystem naming
conventions? The standard format requires using mfd: <Driver>: for the
commit message prefix instead of drivers/mfd:.

> diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
> index 068c25401c6cd..81f07a1d780c5 100644
> --- a/drivers/mfd/ti_am335x_tscadc.c
> +++ b/drivers/mfd/ti_am335x_tscadc.c
[ ... ]
> @@ -373,7 +373,7 @@ MODULE_DEVICE_TABLE(of, ti_tscadc_dt_ids);
>  static struct platform_driver ti_tscadc_driver = {
>  	.driver = {
>  		.name   = "ti_am3359-tscadc",
> -		.pm	= &tscadc_pm_ops,
> +		.pm	= pm_sleep_ptr(&tscadc_pm_ops),
>  		.of_match_table = ti_tscadc_dt_ids,
>  	},
>  	.probe	= ti_tscadc_probe,

[Severity: High]
This is a pre-existing issue, but does ti_tscadc_remove() cause a kernel panic
by disabling PM runtime before unregistering child devices?

When the module is unloaded, ti_tscadc_remove() drops the clock reference and
disables PM runtime:

    pm_runtime_put_sync(&pdev->dev);
    pm_runtime_disable(&pdev->dev);
    mfd_remove_devices(tscadc->dev);

When mfd_remove_devices() unbinds the ti_am335x_adc child driver, the child's
tiadc_remove() calls am335x_tsc_se_clr(). This issues a regmap_write() to the
REG_SE MMIO register while the parent device's clock is already powered down,
which triggers an L3 interconnect error and kernel panic.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
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.