Skip to content

Commit 9ef9589

Browse files
liuxp11Wim Van Sebroeck
authored andcommitted
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 <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent b3ac0c5 commit 9ef9589

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

drivers/watchdog/iTCO_wdt.c

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -596,23 +596,22 @@ static int iTCO_wdt_probe(struct platform_device *pdev)
596596
return 0;
597597
}
598598

599-
#ifdef CONFIG_PM_SLEEP
600599
/*
601600
* Suspend-to-idle requires this, because it stops the ticks and timekeeping, so
602601
* the watchdog cannot be pinged while in that state. In ACPI sleep states the
603602
* watchdog is stopped by the platform firmware.
604603
*/
605604

606605
#ifdef CONFIG_ACPI
607-
static inline bool need_suspend(void)
606+
static inline bool __maybe_unused need_suspend(void)
608607
{
609608
return acpi_target_system_state() == ACPI_STATE_S0;
610609
}
611610
#else
612-
static inline bool need_suspend(void) { return true; }
611+
static inline bool __maybe_unused need_suspend(void) { return true; }
613612
#endif
614613

615-
static int iTCO_wdt_suspend_noirq(struct device *dev)
614+
static int __maybe_unused iTCO_wdt_suspend_noirq(struct device *dev)
616615
{
617616
struct iTCO_wdt_private *p = dev_get_drvdata(dev);
618617
int ret = 0;
@@ -626,7 +625,7 @@ static int iTCO_wdt_suspend_noirq(struct device *dev)
626625
return ret;
627626
}
628627

629-
static int iTCO_wdt_resume_noirq(struct device *dev)
628+
static int __maybe_unused iTCO_wdt_resume_noirq(struct device *dev)
630629
{
631630
struct iTCO_wdt_private *p = dev_get_drvdata(dev);
632631

@@ -637,20 +636,15 @@ static int iTCO_wdt_resume_noirq(struct device *dev)
637636
}
638637

639638
static const struct dev_pm_ops iTCO_wdt_pm = {
640-
.suspend_noirq = iTCO_wdt_suspend_noirq,
641-
.resume_noirq = iTCO_wdt_resume_noirq,
639+
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(iTCO_wdt_suspend_noirq,
640+
iTCO_wdt_resume_noirq)
642641
};
643642

644-
#define ITCO_WDT_PM_OPS (&iTCO_wdt_pm)
645-
#else
646-
#define ITCO_WDT_PM_OPS NULL
647-
#endif /* CONFIG_PM_SLEEP */
648-
649643
static struct platform_driver iTCO_wdt_driver = {
650644
.probe = iTCO_wdt_probe,
651645
.driver = {
652646
.name = DRV_NAME,
653-
.pm = ITCO_WDT_PM_OPS,
647+
.pm = &iTCO_wdt_pm,
654648
},
655649
};
656650

0 commit comments

Comments
 (0)