summaryrefslogtreecommitdiffstats
path: root/drivers/watchdog/hpwdt.c
diff options
context:
space:
mode:
authorJerry Hoemann <jerry.hoemann@hpe.com>2024-02-14 09:49:40 -0700
committerWim Van Sebroeck <wim@linux-watchdog.org>2024-03-03 14:17:30 +0100
commit12b8ab42e1c509121a8d4fae1ba57d3d0f22f571 (patch)
tree12bd47fa18c567911c443fcd9e79919c34121f69 /drivers/watchdog/hpwdt.c
parent588b82546d585e8b6ab9c2af06a8ac1d4e5731ab (diff)
downloadlinux-stable-12b8ab42e1c509121a8d4fae1ba57d3d0f22f571.tar.gz
linux-stable-12b8ab42e1c509121a8d4fae1ba57d3d0f22f571.tar.bz2
linux-stable-12b8ab42e1c509121a8d4fae1ba57d3d0f22f571.zip
watchdog/hpwdt: Support Suspend and Resume
Add call backs to support suspend and resume. Signed-off-by: Jerry Hoemann <jerry.hoemann@hpe.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20240214164941.630775-2-jerry.hoemann@hpe.com Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Diffstat (limited to 'drivers/watchdog/hpwdt.c')
-rw-r--r--drivers/watchdog/hpwdt.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index 138dc8d8ca3d..ae30e394d176 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -378,11 +378,36 @@ static void hpwdt_exit(struct pci_dev *dev)
pci_disable_device(dev);
}
+static int hpwdt_suspend(struct device *dev)
+{
+ if (watchdog_active(&hpwdt_dev))
+ hpwdt_stop();
+
+ return 0;
+}
+
+static int hpwdt_resume(struct device *dev)
+{
+ if (watchdog_active(&hpwdt_dev))
+ hpwdt_start(&hpwdt_dev);
+
+ return 0;
+}
+
+static const struct dev_pm_ops hpwdt_pm_ops = {
+ LATE_SYSTEM_SLEEP_PM_OPS(hpwdt_suspend, hpwdt_resume)
+};
+
static struct pci_driver hpwdt_driver = {
.name = "hpwdt",
.id_table = hpwdt_devices,
.probe = hpwdt_init_one,
.remove = hpwdt_exit,
+
+ .driver = {
+ .name = "hpwdt",
+ .pm = &hpwdt_pm_ops,
+ }
};
MODULE_AUTHOR("Tom Mingarelli");