watchdog: iTCO_wdt: Using existing macro define covers more scenarios
For power management, SET_NOIRQ_SYSTEM_SLEEP_PM_OPS defined for CONFIG_PM_SLEEP, will point ->suspend_noirq, ->freeze_noirq and ->poweroff_noirq to the same function. Vice versa happens for ->resume_noirq, ->thaw_noirq and ->restore_noirq. Signed-off-by: Liu Xinpeng <liuxp11@chinatelecom.cn> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/1650967905-3199-1-git-send-email-liuxp11@chinatelecom.cn Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
This commit is contained in:
Родитель
b3ac0c58fa
Коммит
9ef958929f
|
@ -596,7 +596,6 @@ static int iTCO_wdt_probe(struct platform_device *pdev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PM_SLEEP
|
|
||||||
/*
|
/*
|
||||||
* Suspend-to-idle requires this, because it stops the ticks and timekeeping, so
|
* Suspend-to-idle requires this, because it stops the ticks and timekeeping, so
|
||||||
* the watchdog cannot be pinged while in that state. In ACPI sleep states the
|
* the watchdog cannot be pinged while in that state. In ACPI sleep states the
|
||||||
|
@ -604,15 +603,15 @@ static int iTCO_wdt_probe(struct platform_device *pdev)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef CONFIG_ACPI
|
#ifdef CONFIG_ACPI
|
||||||
static inline bool need_suspend(void)
|
static inline bool __maybe_unused need_suspend(void)
|
||||||
{
|
{
|
||||||
return acpi_target_system_state() == ACPI_STATE_S0;
|
return acpi_target_system_state() == ACPI_STATE_S0;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static inline bool need_suspend(void) { return true; }
|
static inline bool __maybe_unused need_suspend(void) { return true; }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int iTCO_wdt_suspend_noirq(struct device *dev)
|
static int __maybe_unused iTCO_wdt_suspend_noirq(struct device *dev)
|
||||||
{
|
{
|
||||||
struct iTCO_wdt_private *p = dev_get_drvdata(dev);
|
struct iTCO_wdt_private *p = dev_get_drvdata(dev);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
@ -626,7 +625,7 @@ static int iTCO_wdt_suspend_noirq(struct device *dev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int iTCO_wdt_resume_noirq(struct device *dev)
|
static int __maybe_unused iTCO_wdt_resume_noirq(struct device *dev)
|
||||||
{
|
{
|
||||||
struct iTCO_wdt_private *p = dev_get_drvdata(dev);
|
struct iTCO_wdt_private *p = dev_get_drvdata(dev);
|
||||||
|
|
||||||
|
@ -637,20 +636,15 @@ static int iTCO_wdt_resume_noirq(struct device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dev_pm_ops iTCO_wdt_pm = {
|
static const struct dev_pm_ops iTCO_wdt_pm = {
|
||||||
.suspend_noirq = iTCO_wdt_suspend_noirq,
|
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(iTCO_wdt_suspend_noirq,
|
||||||
.resume_noirq = iTCO_wdt_resume_noirq,
|
iTCO_wdt_resume_noirq)
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ITCO_WDT_PM_OPS (&iTCO_wdt_pm)
|
|
||||||
#else
|
|
||||||
#define ITCO_WDT_PM_OPS NULL
|
|
||||||
#endif /* CONFIG_PM_SLEEP */
|
|
||||||
|
|
||||||
static struct platform_driver iTCO_wdt_driver = {
|
static struct platform_driver iTCO_wdt_driver = {
|
||||||
.probe = iTCO_wdt_probe,
|
.probe = iTCO_wdt_probe,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = DRV_NAME,
|
.name = DRV_NAME,
|
||||||
.pm = ITCO_WDT_PM_OPS,
|
.pm = &iTCO_wdt_pm,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче