watchdog: PM: use DEFINE_SIMPLE_DEV_PM_OPS and pm_sleep_ptr for dev_pm_ops

Replace the deprecated SIMPLE_DEV_PM_OPS with DEFINE_SIMPLE_DEV_PM_OPS.
This also drops the __maybe_unused annotations on the suspend/resume
callbacks, since pm_sleep_ptr() inside the new macro already handles
the case where CONFIG_PM_SLEEP is disabled. Wrap the dev_pm_ops
assignment with pm_sleep_ptr() so the entire dev_pm_ops structure
is dropped when CONFIG_PM_SLEEP is disabled, instead of leaving
it as a dead struct with NULL callbacks.

Signed-off-by: Li Jun <lijun01@kylinos.cn>
Link: https://patch.msgid.link/20260910124730.1127847-1-lijun01@kylinos.cn
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Li Jun 2026-09-10 20:47:30 +08:00 committed by Guenter Roeck
parent f12d5facde
commit 17908f8997
7 changed files with 28 additions and 28 deletions

View File

@ -359,7 +359,7 @@ static int cdns_wdt_probe(struct platform_device *pdev)
* @dev: handle to the device structure.
* Return: 0 always.
*/
static int __maybe_unused cdns_wdt_suspend(struct device *dev)
static int cdns_wdt_suspend(struct device *dev)
{
struct cdns_wdt *wdt = dev_get_drvdata(dev);
@ -377,7 +377,7 @@ static int __maybe_unused cdns_wdt_suspend(struct device *dev)
* @dev: handle to the device structure.
* Return: 0 on success, errno otherwise.
*/
static int __maybe_unused cdns_wdt_resume(struct device *dev)
static int cdns_wdt_resume(struct device *dev)
{
int ret;
struct cdns_wdt *wdt = dev_get_drvdata(dev);
@ -394,7 +394,7 @@ static int __maybe_unused cdns_wdt_resume(struct device *dev)
return 0;
}
static SIMPLE_DEV_PM_OPS(cdns_wdt_pm_ops, cdns_wdt_suspend, cdns_wdt_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(cdns_wdt_pm_ops, cdns_wdt_suspend, cdns_wdt_resume);
static const struct of_device_id cdns_wdt_of_match[] = {
{ .compatible = "cdns,wdt-r1p2", },
@ -408,7 +408,7 @@ static struct platform_driver cdns_wdt_driver = {
.driver = {
.name = "cdns-wdt",
.of_match_table = cdns_wdt_of_match,
.pm = &cdns_wdt_pm_ops,
.pm = pm_sleep_ptr(&cdns_wdt_pm_ops),
},
};

View File

@ -248,7 +248,7 @@ static int da9062_wdt_probe(struct platform_device *pdev)
return devm_watchdog_register_device(dev, &wdt->wdtdev);
}
static int __maybe_unused da9062_wdt_suspend(struct device *dev)
static int da9062_wdt_suspend(struct device *dev)
{
struct watchdog_device *wdd = dev_get_drvdata(dev);
struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd);
@ -262,7 +262,7 @@ static int __maybe_unused da9062_wdt_suspend(struct device *dev)
return 0;
}
static int __maybe_unused da9062_wdt_resume(struct device *dev)
static int da9062_wdt_resume(struct device *dev)
{
struct watchdog_device *wdd = dev_get_drvdata(dev);
struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd);
@ -276,14 +276,14 @@ static int __maybe_unused da9062_wdt_resume(struct device *dev)
return 0;
}
static SIMPLE_DEV_PM_OPS(da9062_wdt_pm_ops,
static DEFINE_SIMPLE_DEV_PM_OPS(da9062_wdt_pm_ops,
da9062_wdt_suspend, da9062_wdt_resume);
static struct platform_driver da9062_wdt_driver = {
.probe = da9062_wdt_probe,
.driver = {
.name = "da9062-watchdog",
.pm = &da9062_wdt_pm_ops,
.pm = pm_sleep_ptr(&da9062_wdt_pm_ops),
.of_match_table = da9062_compatible_id_table,
},
};

View File

@ -250,7 +250,7 @@ static int keembay_wdt_probe(struct platform_device *pdev)
return 0;
}
static int __maybe_unused keembay_wdt_suspend(struct device *dev)
static int keembay_wdt_suspend(struct device *dev)
{
struct keembay_wdt *wdt = dev_get_drvdata(dev);
@ -260,7 +260,7 @@ static int __maybe_unused keembay_wdt_suspend(struct device *dev)
return 0;
}
static int __maybe_unused keembay_wdt_resume(struct device *dev)
static int keembay_wdt_resume(struct device *dev)
{
struct keembay_wdt *wdt = dev_get_drvdata(dev);
@ -270,7 +270,7 @@ static int __maybe_unused keembay_wdt_resume(struct device *dev)
return 0;
}
static SIMPLE_DEV_PM_OPS(keembay_wdt_pm_ops, keembay_wdt_suspend,
static DEFINE_SIMPLE_DEV_PM_OPS(keembay_wdt_pm_ops, keembay_wdt_suspend,
keembay_wdt_resume);
static const struct of_device_id keembay_wdt_match[] = {
@ -284,7 +284,7 @@ static struct platform_driver keembay_wdt_driver = {
.driver = {
.name = "keembay_wdt",
.of_match_table = keembay_wdt_match,
.pm = &keembay_wdt_pm_ops,
.pm = pm_sleep_ptr(&keembay_wdt_pm_ops),
},
};

View File

@ -184,7 +184,7 @@ static int msc313e_wdt_probe(struct platform_device *pdev)
return ret;
}
static int __maybe_unused msc313e_wdt_suspend(struct device *dev)
static int msc313e_wdt_suspend(struct device *dev)
{
struct msc313e_wdt_priv *priv = dev_get_drvdata(dev);
@ -194,7 +194,7 @@ static int __maybe_unused msc313e_wdt_suspend(struct device *dev)
return 0;
}
static int __maybe_unused msc313e_wdt_resume(struct device *dev)
static int msc313e_wdt_resume(struct device *dev)
{
struct msc313e_wdt_priv *priv = dev_get_drvdata(dev);
int ret = 0;
@ -208,13 +208,13 @@ static int __maybe_unused msc313e_wdt_resume(struct device *dev)
return ret;
}
static SIMPLE_DEV_PM_OPS(msc313e_wdt_pm_ops, msc313e_wdt_suspend, msc313e_wdt_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(msc313e_wdt_pm_ops, msc313e_wdt_suspend, msc313e_wdt_resume);
static struct platform_driver msc313e_wdt_driver = {
.driver = {
.name = "msc313e-wdt",
.of_match_table = msc313e_wdt_of_match,
.pm = &msc313e_wdt_pm_ops,
.pm = pm_sleep_ptr(&msc313e_wdt_pm_ops),
},
.probe = msc313e_wdt_probe,
};

View File

@ -251,7 +251,7 @@ static int xwdt_probe(struct platform_device *pdev)
* @dev: handle to the device structure.
* Return: 0 always.
*/
static int __maybe_unused xwdt_suspend(struct device *dev)
static int xwdt_suspend(struct device *dev)
{
struct xwdt_device *xdev = dev_get_drvdata(dev);
@ -267,7 +267,7 @@ static int __maybe_unused xwdt_suspend(struct device *dev)
* @dev: handle to the device structure.
* Return: 0 on success, errno otherwise.
*/
static int __maybe_unused xwdt_resume(struct device *dev)
static int xwdt_resume(struct device *dev)
{
struct xwdt_device *xdev = dev_get_drvdata(dev);
int ret = 0;
@ -278,7 +278,7 @@ static int __maybe_unused xwdt_resume(struct device *dev)
return ret;
}
static SIMPLE_DEV_PM_OPS(xwdt_pm_ops, xwdt_suspend, xwdt_resume);
static DEFINE_SIMPLE_DEV_PM_OPS(xwdt_pm_ops, xwdt_suspend, xwdt_resume);
/* Match table for of_platform binding */
static const struct of_device_id xwdt_of_match[] = {
@ -293,7 +293,7 @@ static struct platform_driver xwdt_driver = {
.driver = {
.name = WATCHDOG_NAME,
.of_match_table = xwdt_of_match,
.pm = &xwdt_pm_ops,
.pm = pm_sleep_ptr(&xwdt_pm_ops),
},
};

View File

@ -233,7 +233,7 @@ static int pm8916_wdt_probe(struct platform_device *pdev)
return devm_watchdog_register_device(dev, &wdt->wdev);
}
static int __maybe_unused pm8916_wdt_suspend(struct device *dev)
static int pm8916_wdt_suspend(struct device *dev)
{
struct pm8916_wdt *wdt = dev_get_drvdata(dev);
@ -243,7 +243,7 @@ static int __maybe_unused pm8916_wdt_suspend(struct device *dev)
return 0;
}
static int __maybe_unused pm8916_wdt_resume(struct device *dev)
static int pm8916_wdt_resume(struct device *dev)
{
struct pm8916_wdt *wdt = dev_get_drvdata(dev);
@ -253,7 +253,7 @@ static int __maybe_unused pm8916_wdt_resume(struct device *dev)
return 0;
}
static SIMPLE_DEV_PM_OPS(pm8916_wdt_pm_ops, pm8916_wdt_suspend,
static DEFINE_SIMPLE_DEV_PM_OPS(pm8916_wdt_pm_ops, pm8916_wdt_suspend,
pm8916_wdt_resume);
static const struct of_device_id pm8916_wdt_id_table[] = {
@ -267,7 +267,7 @@ static struct platform_driver pm8916_wdt_driver = {
.driver = {
.name = "pm8916-wdt",
.of_match_table = pm8916_wdt_id_table,
.pm = &pm8916_wdt_pm_ops,
.pm = pm_sleep_ptr(&pm8916_wdt_pm_ops),
},
};
module_platform_driver(pm8916_wdt_driver);

View File

@ -114,7 +114,7 @@ static void stmp3xxx_wdt_remove(struct platform_device *pdev)
unregister_reboot_notifier(&wdt_notifier);
}
static int __maybe_unused stmp3xxx_wdt_suspend(struct device *dev)
static int stmp3xxx_wdt_suspend(struct device *dev)
{
struct watchdog_device *wdd = &stmp3xxx_wdd;
@ -124,7 +124,7 @@ static int __maybe_unused stmp3xxx_wdt_suspend(struct device *dev)
return 0;
}
static int __maybe_unused stmp3xxx_wdt_resume(struct device *dev)
static int stmp3xxx_wdt_resume(struct device *dev)
{
struct watchdog_device *wdd = &stmp3xxx_wdd;
@ -134,13 +134,13 @@ static int __maybe_unused stmp3xxx_wdt_resume(struct device *dev)
return 0;
}
static SIMPLE_DEV_PM_OPS(stmp3xxx_wdt_pm_ops,
static DEFINE_SIMPLE_DEV_PM_OPS(stmp3xxx_wdt_pm_ops,
stmp3xxx_wdt_suspend, stmp3xxx_wdt_resume);
static struct platform_driver stmp3xxx_wdt_driver = {
.driver = {
.name = "stmp3xxx_rtc_wdt",
.pm = &stmp3xxx_wdt_pm_ops,
.pm = pm_sleep_ptr(&stmp3xxx_wdt_pm_ops),
},
.probe = stmp3xxx_wdt_probe,
.remove = stmp3xxx_wdt_remove,