* [PATCH] drivers/mfd: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
@ 2026-08-21 9:25 Triet Hoang
2026-08-21 9:35 ` sashiko-bot
0 siblings, 1 reply; 3+ messages in thread
From: Triet Hoang @ 2026-08-21 9:25 UTC (permalink / raw)
To: lee; +Cc: mfd, Triet Hoang
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 or
CONFIG_PM_SLEEP is disabled.
Signed-off-by: Triet Hoang <triet.hoang.dev@gmail.com>
---
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(-)
diff --git a/drivers/mfd/iqs62x.c b/drivers/mfd/iqs62x.c
index ee017617d1d1..bea1ebdca9e7 100644
--- a/drivers/mfd/iqs62x.c
+++ b/drivers/mfd/iqs62x.c
@@ -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,
diff --git a/drivers/mfd/max77843.c b/drivers/mfd/max77843.c
index 2a48577b1a79..9ae6715642ae 100644
--- a/drivers/mfd/max77843.c
+++ b/drivers/mfd/max77843.c
@@ -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,
},
diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c
index b9b1036c8ff4..8a97c30cad3f 100644
--- a/drivers/mfd/mt6360-core.c
+++ b/drivers/mfd/mt6360-core.c
@@ -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,
diff --git a/drivers/mfd/rk8xx-i2c.c b/drivers/mfd/rk8xx-i2c.c
index 2951b2911a37..161b25fbe146 100644
--- a/drivers/mfd/rk8xx-i2c.c
+++ b/drivers/mfd/rk8xx-i2c.c
@@ -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,
diff --git a/drivers/mfd/rn5t618.c b/drivers/mfd/rn5t618.c
index 23ca00d2c624..8c68dd16bb9e 100644
--- a/drivers/mfd/rn5t618.c
+++ b/drivers/mfd/rn5t618.c
@@ -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,
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 068c25401c6c..81f07a1d780c 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -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,
diff --git a/drivers/mfd/tps6586x.c b/drivers/mfd/tps6586x.c
index 3cfd2f02b62f..600186b1e8cb 100644
--- a/drivers/mfd/tps6586x.c
+++ b/drivers/mfd/tps6586x.c
@@ -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,
diff --git a/drivers/mfd/twl-core.c b/drivers/mfd/twl-core.c
index c024a28b057e..b7d749208131 100644
--- a/drivers/mfd/twl-core.c
+++ b/drivers/mfd/twl-core.c
@@ -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,
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drivers/mfd: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
2026-08-21 9:25 [PATCH] drivers/mfd: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Triet Hoang
@ 2026-08-21 9:35 ` sashiko-bot
2026-08-27 13:55 ` Lee Jones
0 siblings, 1 reply; 3+ messages in thread
From: sashiko-bot @ 2026-08-21 9:35 UTC (permalink / raw)
To: Triet Hoang; +Cc: mfd, lee
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 <triet.hoang.dev@gmail.com>
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/20260821092508.324787-1-triet.hoang.dev@gmail.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] drivers/mfd: Convert to DEFINE_SIMPLE_DEV_PM_OPS()
2026-08-21 9:35 ` sashiko-bot
@ 2026-08-27 13:55 ` Lee Jones
0 siblings, 0 replies; 3+ messages in thread
From: Lee Jones @ 2026-08-27 13:55 UTC (permalink / raw)
To: sashiko-reviews; +Cc: Triet Hoang, mfd
On Fri, 21 Aug 2026, sashiko-bot@kernel.org 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.
> 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 <triet.hoang.dev@gmail.com>
>
> 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().
The commit message needs reformatting to avoid the needless early
line feeds.
> > 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/20260821092508.324787-1-triet.hoang.dev@gmail.com?part=1
--
Lee Jones
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-08-27 13:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-21 9:25 [PATCH] drivers/mfd: Convert to DEFINE_SIMPLE_DEV_PM_OPS() Triet Hoang
2026-08-21 9:35 ` sashiko-bot
2026-08-27 13:55 ` Lee Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).