diff options
author | Wim Van Sebroeck <wim@iguana.be> | 2011-07-22 20:58:21 +0200 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2011-07-28 10:01:11 +0200 |
commit | 014d694e5d59e4219803cd14deaae496d86e4910 (patch) | |
tree | c79d00c812b6f01fc477318cbcc003e2826f9f24 /drivers/watchdog/watchdog_dev.c | |
parent | watchdog: WatchDog Timer Driver Core - Add WDIOC_SETOPTIONS ioctl (diff) | |
download | linux-014d694e5d59e4219803cd14deaae496d86e4910.tar.xz linux-014d694e5d59e4219803cd14deaae496d86e4910.zip |
watchdog: WatchDog Timer Driver Core - Add WDIOC_SETTIMEOUT and WDIOC_GETTIMEOUT ioctl
This part add's the WDIOC_SETTIMEOUT and WDIOC_GETTIMEOUT ioctl
functionality to the WatchDog Timer Driver Core framework.
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>
Diffstat (limited to 'drivers/watchdog/watchdog_dev.c')
-rw-r--r-- | drivers/watchdog/watchdog_dev.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/watchdog/watchdog_dev.c b/drivers/watchdog/watchdog_dev.c index 9f5550e16ab5..2c0289deaadd 100644 --- a/drivers/watchdog/watchdog_dev.c +++ b/drivers/watchdog/watchdog_dev.c @@ -190,6 +190,26 @@ static long watchdog_ioctl(struct file *file, unsigned int cmd, return -EOPNOTSUPP; watchdog_ping(wdd); return 0; + case WDIOC_SETTIMEOUT: + if ((wdd->ops->set_timeout == NULL) || + !(wdd->info->options & WDIOF_SETTIMEOUT)) + return -EOPNOTSUPP; + if (get_user(val, p)) + return -EFAULT; + err = wdd->ops->set_timeout(wdd, val); + if (err < 0) + return err; + wdd->timeout = val; + /* If the watchdog is active then we send a keepalive ping + * to make sure that the watchdog keep's running (and if + * possible that it takes the new timeout) */ + watchdog_ping(wdd); + /* Fall */ + case WDIOC_GETTIMEOUT: + /* timeout == 0 means that we don't know the timeout */ + if (wdd->timeout == 0) + return -EOPNOTSUPP; + return put_user(wdd->timeout, p); default: return -ENOTTY; } |