watchdog: WatchDog Timer Driver Core - Add WDIOC_KEEPALIVE ioctl
authorWim Van Sebroeck <wim@iguana.be>
Fri, 22 Jul 2011 18:57:23 +0000 (18:57 +0000)
committerWim Van Sebroeck <wim@iguana.be>
Thu, 28 Jul 2011 08:01:07 +0000 (08:01 +0000)
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.

Signed-off-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Wolfram Sang <w.sang@pengutronix.de>
Documentation/watchdog/watchdog-kernel-api.txt
drivers/watchdog/watchdog_dev.c

index 2bdc6dc6e04c9fe1f6675c2bcc80762bf6620fb3..abbcf2ce8f62e9e1b86b8eaeae660e8eba8d2352 100644 (file)
@@ -101,6 +101,9 @@ they are supported. These optional routines/operations are:
   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).
   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.
 
 * status: this routine checks the status of the watchdog timer device. The
   status of the device is reported with watchdog WDIOF_* status flags/bits.
 
index 00a6112930650db64c1351a90d6144331f097757..2fb4cecd50d884168d958bbd6f1c1114befeaeaf 100644 (file)
@@ -120,6 +120,11 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd,
                return put_user(val, p);
        case WDIOC_GETBOOTSTATUS:
                return put_user(wdd->bootstatus, p);
                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;
        }
        default:
                return -ENOTTY;
        }
This page took 0.039164 seconds and 5 git commands to generate.