All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] watchdog: hpwdt: Add support for WDIOC_SETOPTIONS
@ 2015-06-21  7:32 Jean Delvare
  2015-06-21 12:34 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Jean Delvare @ 2015-06-21  7:32 UTC (permalink / raw)
  To: linux-watchdog; +Cc: Wim Van Sebroeck, Mingarelli, Thomas, Guenter Roeck

WDIOC_SETOPTIONS makes it possible to disable and re-enable the
watchdog timer while the hpwdt driver is loaded.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Wim Van Sebroeck <wim@iguana.be>
---
Untested. It would be great if someone at HP (or anyone with the
hardware, I guess) could test and review this patch. Thanks.

Changes since v1:
 * Drop useless "ret = 0" statements as suggested by Guenter.

 drivers/watchdog/hpwdt.c |   16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

--- linux-4.1-rc8.orig/drivers/watchdog/hpwdt.c	2015-06-20 12:56:17.933391230 +0200
+++ linux-4.1-rc8/drivers/watchdog/hpwdt.c	2015-06-21 08:31:21.671106961 +0200
@@ -588,7 +588,7 @@ static long hpwdt_ioctl(struct file *fil
 {
 	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 *fil
 		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)


-- 
Jean Delvare
SUSE L3 Support

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] watchdog: hpwdt: Add support for WDIOC_SETOPTIONS
  2015-06-21  7:32 [PATCH v2] watchdog: hpwdt: Add support for WDIOC_SETOPTIONS Jean Delvare
@ 2015-06-21 12:34 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2015-06-21 12:34 UTC (permalink / raw)
  To: Jean Delvare, linux-watchdog; +Cc: Wim Van Sebroeck, Mingarelli, Thomas

On 06/21/2015 12:32 AM, Jean Delvare wrote:
> WDIOC_SETOPTIONS makes it possible to disable and re-enable the
> watchdog timer while the hpwdt driver is loaded.
>
> Signed-off-by: Jean Delvare <jdelvare@suse.de>
> Cc: Wim Van Sebroeck <wim@iguana.be>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-21 12:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-21  7:32 [PATCH v2] watchdog: hpwdt: Add support for WDIOC_SETOPTIONS Jean Delvare
2015-06-21 12:34 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.