From: Jean Delvare Date: Sun, 21 Jun 2015 07:32:33 +0000 (+0200) Subject: watchdog: hpwdt: Add support for WDIOC_SETOPTIONS X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=46c80b20d07e9309677d81e1226dc30a055b63b7;p=linux-beck.git watchdog: hpwdt: Add support for WDIOC_SETOPTIONS WDIOC_SETOPTIONS makes it possible to disable and re-enable the watchdog timer while the hpwdt driver is loaded. Signed-off-by: Jean Delvare Reviewed-by: Guenter Roeck Signed-off-by: Wim Van Sebroeck --- diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c index ada3e44f9932..286369d4f0f5 100644 --- a/drivers/watchdog/hpwdt.c +++ b/drivers/watchdog/hpwdt.c @@ -588,7 +588,7 @@ static long hpwdt_ioctl(struct file *file, unsigned int cmd, { void __user *argp = (void __user *)arg; int __user *p = argp; - int new_margin; + int new_margin, options; int ret = -ENOTTY; switch (cmd) { @@ -608,6 +608,20 @@ static long hpwdt_ioctl(struct file *file, unsigned int cmd, ret = 0; break; + case WDIOC_SETOPTIONS: + ret = get_user(options, p); + if (ret) + break; + + if (options & WDIOS_DISABLECARD) + hpwdt_stop(); + + if (options & WDIOS_ENABLECARD) { + hpwdt_start(); + hpwdt_ping(); + } + break; + case WDIOC_SETTIMEOUT: ret = get_user(new_margin, p); if (ret)