39 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
41 #include <linux/module.h>
43 #include <linux/types.h>
46 #include <linux/watchdog.h>
48 #include <linux/reboot.h>
51 #include <linux/kernel.h>
53 #define TIMER_MARGIN 60
57 "Watchdog soft_margin in seconds. (0 < soft_margin < 65536, default="
63 "Watchdog cannot be stopped once started (default="
66 static int soft_noboot = 0;
69 "Softdog action, set to 1 to ignore reboots, 0 to reboot (default=0)");
71 static int soft_panic;
74 "Softdog action, set to 1 to panic, 0 to reboot (default=0)");
80 static void watchdog_fire(
unsigned long);
89 static void watchdog_fire(
unsigned long data)
92 pr_crit(
"Triggered - Reboot ignored\n");
93 else if (soft_panic) {
95 panic(
"Software Watchdog Timer expired");
97 pr_crit(
"Initiating system reboot\n");
99 pr_crit(
"Reboot didn't ?????\n");
143 .notifier_call = softdog_notify_sys,
147 .identity =
"Software Watchdog",
153 .start = softdog_ping,
154 .stop = softdog_stop,
155 .ping = softdog_ping,
156 .set_timeout = softdog_set_timeout,
160 .info = &softdog_info,
163 .max_timeout = 0xFFFF
166 static int __init watchdog_init(
void)
172 if (soft_margin < 1 || soft_margin > 65535) {
173 pr_info(
"soft_margin must be 0 < soft_margin < 65536, using %d\n",
177 softdog_dev.
timeout = soft_margin;
179 watchdog_set_nowayout(&softdog_dev, nowayout);
183 pr_err(
"cannot register reboot notifier (err=%d)\n", ret);
193 pr_info(
"Software Watchdog Timer: 0.08 initialized. soft_noboot=%d soft_margin=%d sec soft_panic=%d (nowayout=%d)\n",
194 soft_noboot, soft_margin, soft_panic, nowayout);
199 static void __exit watchdog_exit(
void)