On 12/14/2016 05:37 AM, Rasmus Villemoes wrote:
+config WATCHDOG_OPEN_TIMEOUT
+ int "Default timeout value for opening watchdog device (seconds)"
+ default 0
+ help
+ If a watchdog driver indicates to the framework that the
+ hardware watchdog is running, the framework takes care of
+ pinging the watchdog until userspace opens
+ /dev/watchdogN. This value (overridden by the device's
+ "open-timeout" property if present) sets an upper bound for
+ how long the kernel does this - thus, if userspace hasn't
+ opened the device within the timeout, the board reboots. A
+ value of 0 means there is no timeout.
+
+
Dual empty line. Also, as mentioned before, I am not a friend of such
configuration variables. It forces distribution vendors to make the
decision
for everyone.
Please consider defining a command line parameter such as
watchdog_open_timeout.
diff --git a/include/linux/watchdog.h b/include/linux/watchdog.h
index 35a4d81..a89a293 100644
--- a/include/linux/watchdog.h
+++ b/include/linux/watchdog.h
@@ -76,6 +76,11 @@ struct watchdog_ops {
* @max_hw_heartbeat_ms:
* Hardware limit for maximum timeout, in milli-seconds.
* Replaces max_timeout if specified.
+ * @open_timeout:
+ * The maximum time for which the kernel will ping the
+ * device after registration.
+ * @open_deadline:
+ * Set to jiffies + @open_timeout at registration.
* @reboot_nb: The notifier block to stop watchdog on reboot.
* @restart_nb: The notifier block to register a restart function.
* @driver_data:Pointer to the drivers private data.
@@ -107,6 +112,8 @@ struct watchdog_device {
unsigned int max_timeout;
unsigned int min_hw_heartbeat_ms;
unsigned int max_hw_heartbeat_ms;
+ unsigned int open_timeout;
+ unsigned long open_deadline;
None of those need to be visible in drivers. I don't see why the
variables should be
defined here and not in struct watchdog_core_data.