Skip to contentSkip to conversation

Generic Watchdog Timer Driver

PATCH Superseded Wim Van Sebroeck 2 participants 2 messages Jun 18, 2011

Subsystems (2)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 3/10 Generic Watchdog Timer Driver

watchdog: WatchDog Timer Driver Core - Part 3

This part add's the WDIOC_KEEPALIVE ioctl functionality to the WatchDog Timer Driver Core framework. Please note that the WDIOF_KEEPALIVEPING bit has to be set in the watchdog_info options field.

Documentation/watchdog/src/watchdog-with-timer-example.c +1 -0
diff -urN linux-2.6.38-generic-part2/Documentation/watchdog/src/watchdog-with-timer-example.c linux-2.6.38-generic-part3/Documentation/watchdog/src/watchdog-with-timer-example.c
@@ -117,6 +117,7 @@
  */
 static const struct watchdog_info wdt_info = {
 	.identity =	DRV_NAME,
+	.options =	WDIOF_KEEPALIVEPING,
 };
 
 static const struct watchdog_ops wdt_ops = {
Documentation/watchdog/watchdog-kernel-api.txt +3 -0
diff -urN linux-2.6.38-generic-part2/Documentation/watchdog/watchdog-kernel-api.txt linux-2.6.38-generic-part3/Documentation/watchdog/watchdog-kernel-api.txt
@@ -101,6 +101,9 @@
   the watchdog timer driver core does: to send a keepalive ping to the watchdog
   timer hardware it will either use the ping operation (when available) or the
   start operation (when the ping operation is not available).
+  (Note: the WDIOC_KEEPALIVE ioctl call will only be active when the
+  WDIOF_KEEPALIVEPING bit has been set in the option field on the watchdog's
+  info structure).
 * status: this routine checks the status of the watchdog timer device. The
   status of the device is reported with watchdog WDIOF_* status flags/bits.
 
drivers/watchdog/core/watchdog_dev.c +5 -0
diff -urN linux-2.6.38-generic-part2/drivers/watchdog/core/watchdog_dev.c linux-2.6.38-generic-part3/drivers/watchdog/core/watchdog_dev.c
@@ -153,6 +153,11 @@
 		return put_user(val, p);
 	case WDIOC_GETBOOTSTATUS:
 		return put_user(wdd->bootstatus, p);
+	case WDIOC_KEEPALIVE:
+		if (!(wdd->info->options & WDIOF_KEEPALIVEPING))
+			return -EOPNOTSUPP;
+		watchdog_ping(wdd);
+		return 0;
 	default:
 		return -ENOTTY;
 	}
Acked-by on v2 3/10
#1 lore raw
Quoted 9 lines · On Saturday 18 June 2011 19:21:36 Wim Van Sebroeck wrote:

watchdog: WatchDog Timer Driver Core - Part 3

This part add's the WDIOC_KEEPALIVE ioctl functionality to the WatchDog Timer Driver Core framework. Please note that the WDIOF_KEEPALIVEPING bit has to be set in the watchdog_info options field.