Skip to contentSkip to conversation

watchdog: hpwdt: Add support for WDIOC_SETOPTIONS

PATCH Superseded Jean Delvare 2 participants 3 messages Jun 19, 2015 – Jun 21, 2015

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

Cc Wim Van Sebroeck <[email protected]>

---
Untested. It would be great if someone at HP (or anyone with the hardware, I guess) could test and review this patch. Thanks.

 drivers/watchdog/hpwdt.c |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/watchdog/hpwdt.c +18 -1
@@ -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,23 @@ 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();
+			ret = 0;
+		}
+
+		if (options & WDIOS_ENABLECARD) {
+			hpwdt_start();
+			hpwdt_ping();
+			ret = 0;
+		}
+		break;
+
 	case WDIOC_SETTIMEOUT:
 		ret = get_user(new_margin, p);
 		if (ret)
Signature · 4 lines
Jean Delvare
SUSE L3 Support
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in
maintainer
#1 lore raw

Hi Jean,

Quoted 9 lines · Jean Delvare

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

Cc Wim Van Sebroeck <[email protected]>

---
Untested. It would be great if someone at HP (or anyone with the hardware, I guess) could test and review this patch. Thanks.

Any chance you can convert the driver to a new style watchdog driver instead ?

Quoted 16 lines
  drivers/watchdog/hpwdt.c |   19 ++++++++++++++++++-
  1 file changed, 18 insertions(+), 1 deletion(-)
drivers/watchdog/hpwdt.c +1 -1
@@ -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,23 @@ static long hpwdt_ioctl(struct file *fil
  		ret = 0;

drivers/watchdog/hpwdt.c static long hpwdt_ioctl(struct file *fil · line 618

Quoted 10 lines
drivers/watchdog/hpwdt.c +8 -0
  		break;
 
+	case WDIOC_SETOPTIONS:
+		ret = get_user(options, p);
+		if (ret)
+			break;
+
+		if (options & WDIOS_DISABLECARD) {
+			hpwdt_stop();
+			ret = 0;

ret is already 0 here.

drivers/watchdog/hpwdt.c static long hpwdt_ioctl(struct file *fil · line 624

Quoted 6 lines
drivers/watchdog/hpwdt.c +6 -0
+		}
+
+		if (options & WDIOS_ENABLECARD) {
+			hpwdt_start();
+			hpwdt_ping();
+			ret = 0;

Same here.

Guenter

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

#2 lore raw

Hi Guenter,

Quoted 6 lines · Guenter Roeck

Hi Jean,

Quoted 3 lines · Jean Delvare

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

Quoted 8 lines
Quoted 5 lines
Cc Wim Van Sebroeck <[email protected]>

---
Untested. It would be great if someone at HP (or anyone with the hardware, I guess) could test and review this patch. Thanks.

Any chance you can convert the driver to a new style watchdog driver instead ?

I knew someone would suggest that at some point. But this would be a much larger change and I don't feel confident doing it myself because I am not able to test the driver.

Quoted 29 lines
Quoted 16 lines
  drivers/watchdog/hpwdt.c |   19 ++++++++++++++++++-
  1 file changed, 18 insertions(+), 1 deletion(-)
drivers/watchdog/hpwdt.c +1 -1
@@ -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,23 @@ static long hpwdt_ioctl(struct file *fil
  		ret = 0;

drivers/watchdog/hpwdt.c static long hpwdt_ioctl(struct file *fil · line 618

Quoted 10 lines
drivers/watchdog/hpwdt.c +8 -0
  		break;
 
+	case WDIOC_SETOPTIONS:
+		ret = get_user(options, p);
+		if (ret)
+			break;
+
+		if (options & WDIOS_DISABLECARD) {
+			hpwdt_stop();
+			ret = 0;

ret is already 0 here.

Quoted 8 lines

drivers/watchdog/hpwdt.c static long hpwdt_ioctl(struct file *fil · line 624

Quoted 6 lines
drivers/watchdog/hpwdt.c +6 -0
+		}
+
+		if (options & WDIOS_ENABLECARD) {
+			hpwdt_start();
+			hpwdt_ping();
+			ret = 0;

Same here.

Right. I'll fix it up and send an updated patch. Thanks for the review!

Signature · 4 lines
Jean Delvare
SUSE L3 Support
--
To unsubscribe from this list: send the line "unsubscribe linux-watchdog" in