From: Jean Delvare <jdelvare@suse.de>
To: linux-watchdog@vger.kernel.org
Cc: Wim Van Sebroeck <wim@iguana.be>,
"Mingarelli, Thomas" <Thomas.Mingarelli@hp.com>,
Guenter Roeck <linux@roeck-us.net>
Subject: [PATCH v2] watchdog: hpwdt: Add support for WDIOC_SETOPTIONS
Date: Sun, 21 Jun 2015 09:32:33 +0200 [thread overview]
Message-ID: <20150621093233.2f97739c@endymion.delvare> (raw)
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
next reply other threads:[~2015-06-21 7:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-21 7:32 Jean Delvare [this message]
2015-06-21 12:34 ` [PATCH v2] watchdog: hpwdt: Add support for WDIOC_SETOPTIONS Guenter Roeck
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150621093233.2f97739c@endymion.delvare \
--to=jdelvare@suse.de \
--cc=Thomas.Mingarelli@hp.com \
--cc=linux-watchdog@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=wim@iguana.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox