drivers/mfd: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
Subsystems (4)
PATCH 1/1 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().
This lets us drop the __maybe_unused annotations
from its suspend and resume callbacks,
also reduces kernel size in case CONFIG_PM orCONFIG_PM_SLEEP is disabled.
--- drivers/mfd/iqs62x.c | 8 ++++---- drivers/mfd/max77843.c | 8 ++++---- drivers/mfd/mt6360-core.c | 8 ++++---- drivers/mfd/rk8xx-i2c.c | 4 ++-- drivers/mfd/rn5t618.c | 8 ++++---- drivers/mfd/ti_am335x_tscadc.c | 8 ++++---- drivers/mfd/tps6586x.c | 8 ++++---- drivers/mfd/twl-core.c | 8 ++++---- 8 files changed, 30 insertions(+), 30 deletions(-)
drivers/mfd/iqs62x.c +4 -4
@@ -1015,7 +1015,7 @@ static void iqs62x_remove(struct i2c_client *client)wait_for_completion (&iqs62x->fw_done); } -static int __maybe_unused iqs62x_suspend (struct device *dev) +static int iqs62x_suspend (struct device *dev) {struct iqs62x_core *iqs62x =dev_get_drvdata (dev);int ret;
@@ -1036,7 +1036,7 @@ static int __maybe_unused iqs62x_suspend(struct device *dev) IQS62X_PWR_SETTINGS_PWR_MODE_HALT); } -static int __maybe_unused iqs62x_resume (struct device *dev) +static int iqs62x_resume (struct device *dev) {struct iqs62x_core *iqs62x =dev_get_drvdata (dev);int ret;
@@ -1051,7 +1051,7 @@ static int __maybe_unused iqs62x_resume(struct device *dev) IQS62X_PWR_SETTINGS_DIS_AUTO, 0); } -static SIMPLE_DEV_PM_OPS(iqs62x_pm, iqs62x_suspend, iqs62x_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(iqs62x_pm, iqs62x_suspend, iqs62x_resume);static const struct of_device_id iqs62x_of_match[] = { { .compatible ="azoteq,iqs620a" },
@@ -1067,7 +1067,7 @@ static struct i2c_driver iqs62x_i2c_driver = { .driver = { .name = "iqs62x", .of_match_table = iqs62x_of_match, - .pm = &iqs62x_pm, + .pm = pm_sleep_ptr(&iqs62x_pm), }, .probe = iqs62x_probe, .remove = iqs62x_remove,
drivers/mfd/max77843.c +4 -4
@@ -173,7 +173,7 @@ static const struct i2c_device_id max77843_id[] = { { }, }; -static int __maybe_unused max77843_suspend (struct device *dev) +static int max77843_suspend (struct device *dev) {struct i2c_client *i2c =to_i2c_client (dev);struct max77693_dev *max77843 =i2c_get_clientdata (i2c);
@@ -185,7 +185,7 @@ static int __maybe_unused max77843_suspend(struct device *dev)return 0 ; } -static int __maybe_unused max77843_resume (struct device *dev) +static int max77843_resume (struct device *dev) {struct i2c_client *i2c =to_i2c_client (dev);struct max77693_dev *max77843 =i2c_get_clientdata (i2c);
@@ -197,12 +197,12 @@ static int __maybe_unused max77843_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(max77843_pm, max77843_suspend, max77843_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max77843_pm, max77843_suspend, max77843_resume);static struct i2c_driver max77843_i2c_driver = { .driver = { .name ="max77843" , - .pm = &max77843_pm, + .pm =pm_sleep_ptr (&max77843_pm), .of_match_table = max77843_dt_match, .suppress_bind_attrs = true, },
drivers/mfd/mt6360-core.c +4 -4
@@ -583,7 +583,7 @@ static int mt6360_probe(struct i2c_client *client)return 0 ; } -static int __maybe_unused mt6360_suspend (struct device *dev) +static int mt6360_suspend (struct device *dev) {struct i2c_client *i2c =to_i2c_client (dev);
@@ -593,7 +593,7 @@ static int __maybe_unused mt6360_suspend(struct device *dev)return 0 ; } -static int __maybe_unused mt6360_resume (struct device *dev) +static int mt6360_resume (struct device *dev) {struct i2c_client *i2c =to_i2c_client (dev);
@@ -604,7 +604,7 @@ static int __maybe_unused mt6360_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(mt6360_pm_ops, mt6360_suspend, mt6360_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(mt6360_pm_ops, mt6360_suspend, mt6360_resume);static const struct of_device_id __maybe_unused mt6360_of_id[] = { { .compatible ="mediatek,mt6360" , },
@@ -615,7 +615,7 @@ MODULE_DEVICE_TABLE(of, mt6360_of_id);static struct i2c_driver mt6360_driver = { .driver = { .name ="mt6360" , - .pm = &mt6360_pm_ops, + .pm =pm_sleep_ptr (&mt6360_pm_ops), .of_match_table =of_match_ptr (mt6360_of_id), }, .probe = mt6360_probe,
drivers/mfd/rk8xx-i2c.c +2 -2
@@ -251,7 +251,7 @@ static void rk8xx_i2c_shutdown(struct i2c_client *client)rk8xx_shutdown (&client->dev); } -static SIMPLE_DEV_PM_OPS(rk8xx_i2c_pm_ops, rk8xx_suspend, rk8xx_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(rk8xx_i2c_pm_ops, rk8xx_suspend, rk8xx_resume);static const struct of_device_id rk8xx_i2c_of_match[] = { { .compatible ="rockchip,rk801" , .data = &rk801_data },
@@ -270,7 +270,7 @@ static struct i2c_driver rk8xx_i2c_driver = { .driver = { .name = "rk8xx-i2c", .of_match_table = rk8xx_i2c_of_match, - .pm = &rk8xx_i2c_pm_ops, + .pm = pm_sleep_ptr(&rk8xx_i2c_pm_ops), }, .probe = rk8xx_i2c_probe, .shutdown = rk8xx_i2c_shutdown,
drivers/mfd/rn5t618.c +4 -4
@@ -243,7 +243,7 @@ static void rn5t618_i2c_remove(struct i2c_client *i2c)unregister_restart_handler (&rn5t618_restart_handler); } -static int __maybe_unused rn5t618_i2c_suspend (struct device *dev) +static int rn5t618_i2c_suspend (struct device *dev) {struct rn5t618 *priv =dev_get_drvdata (dev);
@@ -253,7 +253,7 @@ static int __maybe_unused rn5t618_i2c_suspend(struct device *dev)return 0 ; } -static int __maybe_unused rn5t618_i2c_resume (struct device *dev) +static int rn5t618_i2c_resume (struct device *dev) {struct rn5t618 *priv =dev_get_drvdata (dev);
@@ -263,7 +263,7 @@ static int __maybe_unused rn5t618_i2c_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(rn5t618_i2c_dev_pm_ops, +static DEFINE_SIMPLE_DEV_PM_OPS(rn5t618_i2c_dev_pm_ops, rn5t618_i2c_suspend, rn5t618_i2c_resume);
@@ -271,7 +271,7 @@ static struct i2c_driver rn5t618_i2c_driver = { .driver = { .name = "rn5t618", .of_match_table = rn5t618_of_match, - .pm = &rn5t618_i2c_dev_pm_ops, + .pm = pm_sleep_ptr(&rn5t618_i2c_dev_pm_ops), }, .probe = rn5t618_i2c_probe, .remove = rn5t618_i2c_remove,
drivers/mfd/ti_am335x_tscadc.c +4 -4
@@ -313,7 +313,7 @@ static int __maybe_unused ti_tscadc_can_wakeup(struct device *dev, void *data)return device_may_wakeup (dev); } -static int __maybe_unused tscadc_suspend (struct device *dev) +static int tscadc_suspend (struct device *dev) {struct ti_tscadc_dev *tscadc =dev_get_drvdata (dev);
@@ -331,7 +331,7 @@ static int __maybe_unused tscadc_suspend(struct device *dev)return 0 ; } -static int __maybe_unused tscadc_resume (struct device *dev) +static int tscadc_resume (struct device *dev) {struct ti_tscadc_dev *tscadc =dev_get_drvdata (dev);
@@ -345,7 +345,7 @@ static int __maybe_unused tscadc_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(tscadc_pm_ops, tscadc_suspend, tscadc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(tscadc_pm_ops, tscadc_suspend, tscadc_resume);static const struct ti_tscadc_data tscdata = { .adc_feature_name ="TI-am335x-adc" ,
@@ -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,
drivers/mfd/tps6586x.c +4 -4
@@ -618,7 +618,7 @@ static void tps6586x_i2c_remove(struct i2c_client *client)free_irq (client->irq, tps6586x); } -static int __maybe_unused tps6586x_i2c_suspend (struct device *dev) +static int tps6586x_i2c_suspend (struct device *dev) {struct tps6586x *tps6586x =dev_get_drvdata (dev);
@@ -628,7 +628,7 @@ static int __maybe_unused tps6586x_i2c_suspend(struct device *dev)return 0 ; } -static int __maybe_unused tps6586x_i2c_resume (struct device *dev) +static int tps6586x_i2c_resume (struct device *dev) {struct tps6586x *tps6586x =dev_get_drvdata (dev);
@@ -638,7 +638,7 @@ static int __maybe_unused tps6586x_i2c_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(tps6586x_pm_ops, tps6586x_i2c_suspend, +static DEFINE_SIMPLE_DEV_PM_OPS(tps6586x_pm_ops, tps6586x_i2c_suspend, tps6586x_i2c_resume);static const struct i2c_device_id tps6586x_id_table[] = {
@@ -651,7 +651,7 @@ static struct i2c_driver tps6586x_driver = { .driver = { .name = "tps6586x", .of_match_table = of_match_ptr(tps6586x_of_match), - .pm = &tps6586x_pm_ops, + .pm = pm_sleep_ptr(&tps6586x_pm_ops), }, .probe = tps6586x_i2c_probe, .remove = tps6586x_i2c_remove,
drivers/mfd/twl-core.c +4 -4
@@ -903,7 +903,7 @@ twl_probe(struct i2c_client *client)return status; } -static int __maybe_unused twl_suspend (struct device *dev) +static int twl_suspend (struct device *dev) {struct i2c_client *client =to_i2c_client (dev);
@@ -913,7 +913,7 @@ static int __maybe_unused twl_suspend(struct device *dev)return 0 ; } -static int __maybe_unused twl_resume (struct device *dev) +static int twl_resume (struct device *dev) {struct i2c_client *client =to_i2c_client (dev);
@@ -923,7 +923,7 @@ static int __maybe_unused twl_resume(struct device *dev)return 0 ; } -static SIMPLE_DEV_PM_OPS(twl_dev_pm_ops, twl_suspend, twl_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(twl_dev_pm_ops, twl_suspend, twl_resume);static const struct i2c_device_id twl_ids[] = { {"twl4030" ,TWL4030_VAUX2 },/* "Triton 2" */
@@ -942,7 +942,7 @@ static const struct i2c_device_id twl_ids[] = {/* One Client Driver , 4 Clients */ static struct i2c_driver twl_driver = { .driver.name =DRIVER_NAME , - .driver.pm = &twl_dev_pm_ops, + .driver.pm =pm_sleep_ptr (&twl_dev_pm_ops), .id_table = twl_ids, .probe = twl_probe, .remove = twl_remove,
Signature · 1 line
2.53.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
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().
Quoted 1 line
drivers/mfd: Convert toDEFINE_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:.
Quoted 4 lines
drivers/mfd/ti_am335x_tscadc.c +0
-0
[ ... ]
drivers/mfd/ti_am335x_tscadc.c MODULE_DEVICE_TABLE(of, ti_tscadc_dt_ids); · line 379
Quoted 9 lines
drivers/mfd/ti_am335x_tscadc.c +1
-1@@ -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.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Lee Jones
maintainerQuoted 4 lines · On Fri, 21 Aug 2026, [email protected] wrote:
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.
This needs addressing.
Quoted 8 lines
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 toDEFINE_SIMPLE_DEV_PM_OPS()--- commitf2c525c2ee807012f8f33d16a4bcbea747e75dcf
Author: Triet Hoang <[email protected]>
Quoted 5 lines
drivers/mfd: Convert toDEFINE_SIMPLE_DEV_PM_OPS()Convert the deprecated
SIMPLE_DEV_PM_OPS
toDEFINE_SIMPLE_DEV_PM_OPS
andpm_sleep_ptr().
The commit message needs reformatting to avoid the needless early line feeds.
Quoted 40 lines
Quoted 1 line
drivers/mfd: Convert toDEFINE_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 ofdrivers/mfd:.Quoted 4 lines
drivers/mfd/ti_am335x_tscadc.c +0
-0[ ... ]
drivers/mfd/ti_am335x_tscadc.c MODULE_DEVICE_TABLE(of, ti_tscadc_dt_ids); · line 379
Quoted 9 lines
drivers/mfd/ti_am335x_tscadc.c +1
-1@@ -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 doesti_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 theti_am335x_adcchild driver, the child'stiadc_remove()callsam335x_tsc_se_clr(). This issues aregmap_write()to theREG_SEMMIO register while the parent device's clock is already powered down, which triggers an L3 interconnect error and kernel panic.Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Signature · 1 line
Lee Jones