Generic Watchdog Timer Driver
Subsystems (2)
PATCH v2 4/10 Generic Watchdog Timer Driver
watchdog: WatchDog Timer Driver Core - Part 4
This part add's the WDIOC_SETOPTIONS ioctl functionality to the WatchDog Timer Driver Core framework.
Signed-off-by Alan Cox <[email protected]>
Signed-off-by Wim Van Sebroeck <[email protected]>
Documentation/watchdog/src/watchdog-with-timer-example.c +2 -4
@@ -45,11 +45,11 @@ MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. " "(default = " __MODULE_STRING(WDT_TIMEOUT) ")"); +static struct watchdog_device wdt_dev;static void wdt_timer_tick (unsigned long data); static DEFINE_TIMER(timer, wdt_timer_tick, 0, 0);/* The timer that pings the watchdog */ static unsigned long next_heartbeat;/* the next_heartbeat for the timer */ -static unsigned long running;/* is watchdog running for userspace? */ static struct platform_device *wdt_platform_device;
@@ -73,7 +73,7 @@static void wdt_timer_tick (unsigned long data) {if (time_before (jiffies, next_heartbeat) || - (!running)) { + (!test_bit (WDOG_ACTIVE , &wdt_dev.status))) {wdt_reset ();mod_timer (&timer, jiffies +WDT_HEARTBEAT ); }else
@@ -99,7 +99,6 @@/* Start the watchdog timer hardware here */ pr_info ("wdt_start\n" ); - running =1 ;return 0 ; }
@@ -108,7 +107,6 @@/* The watchdog timer hardware can not be stopped... */ pr_info ("wdt_stop\n" ); - running =0 ;return 0 ; }
Documentation/watchdog/watchdog-kernel-api.txt +7 -2
@@ -54,8 +54,9 @@ * bootstatus: status of the device after booting (reported with watchdog WDIOF_* status bits). * status: this field contains a number of status bits that give extra - information about the status of the device (Like: is the device opened via - the /dev/watchdog interface or not, ...) + information about the status of the device (Like: is the watchdog timer + running/active, is the device opened via the /dev/watchdog interface or not, + ...) The list of watchdog operations is defined as:
@@ -109,6 +110,10 @@ The status bits should (preferably) be set with the set_bit and clear_bit alike bit-operations. The status bit's that are defined are: +* WDOG_ACTIVE: this status bit indicates whether or not a watchdog timer device + is active or not. When the watchdog is active after booting, then you should + set this status bit (Note: when you register the watchdog timer device with + this bit set, then opening /dev/watchdog will skip the start operation) * WDOG_DEV_OPEN: this status bit shows whether or not the watchdog device was opened via /dev/watchdog. (This bit should only be used by the WatchDog Timer Driver Core).
drivers/watchdog/core/watchdog_dev.c +72 -7
113 lines not on this page · raw message
include/linux/watchdog.h +1 -0
@@ -80,6 +80,7 @@const struct watchdog_ops *ops;int bootstatus;long status; +#define WDOG_ACTIVE 0/* is the watchdog running/active */ #define WDOG_DEV_OPEN 1/* is the watchdog opened via * /dev/watchdog */ };
Quoted 9 lines · On Saturday 18 June 2011 19:23:01 Wim Van Sebroeck wrote:
watchdog: WatchDog Timer Driver Core - Part 4
This part add's the
WDIOC_SETOPTIONSioctl functionality to the WatchDog Timer Driver Core framework.Signed-off-by Alan Cox <[email protected]>Signed-off-by Wim Van Sebroeck <[email protected]>
Acked-by Arnd Bergmann <[email protected]>