public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Watchdog Stuff (1/4)
@ 2002-06-01  6:43 Joel Becker
  2002-06-01  7:04 ` [PATCH] Watchdog Stuff (2/4) Joel Becker
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Joel Becker @ 2002-06-01  6:43 UTC (permalink / raw)
  To: linux-kernel; +Cc: Rob Radez, Matt Domsch, Alan Cox

	Here are four patches for the watchdog drivers.  These patches
are against 2.4.19-pre9.
	The first patch (this one) adds WDIOC_SETTIMEOUT support to
wafer5823wdt.c.  The second patch adds Matt Domsch's 'nowayout' module
option to the drivers that currently don't have it.  The third patch
fixes a bug where most of the "magic close character" capable drivers
don't use get_user().  The fourth patch adds "magic close character"
support to almost all of the remaining drivers.  It also adds
WDIOF_MAGICCLOSE to the driver info flags.


--- linux-2.4.19-pre9/drivers/char/wafer5823wdt.c	Tue May 28 18:51:38 2002
+++ linux-2.4.19-pre9-nowayout/drivers/char/wafer5823wdt.c	Thu May 30 15:34:14 2002
@@ -54,6 +54,7 @@
 #define WDT_STOP 0x843
 
 #define WD_TIMO 60		/* 1 minute */
+static int wd_margin = WD_TIMO;
 
 static void wafwdt_ping(void)
 {
@@ -67,7 +68,7 @@
 static void wafwdt_start(void)
 {
 	/* start up watchdog */
-	outb_p(WD_TIMO, WDT_START);
+	outb_p(wd_margin, WDT_START);
 	inb_p(WDT_START);
 }
 
@@ -94,8 +95,10 @@
 static int wafwdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
 	     unsigned long arg)
 {
+	int new_margin;
 	static struct watchdog_info ident = {
-		WDIOF_KEEPALIVEPING, 1, "Wafer 5823 WDT"
+		WDIOF_KEEPALIVEPING | WDIOF_SETTIMEOUT,
+		1, "Wafer 5823 WDT"
 	};
 	int one=1;
 
@@ -115,6 +118,18 @@
 		wafwdt_ping();
 		break;
 
+	case WDIOC_SETTIMEOUT:
+		if (get_user(new_margin, (int *)arg))
+			return -EFAULT;
+		if ((new_margin < 1) || (new_margin > 255))
+			return -EINVAL;
+		wd_margin = new_margin;
+		wafwdt_stop();
+		wafwdt_start();
+		/* Fall */
+	case WDIOC_GETTIMEOUT:
+		return put_user(wd_margin, (int *)arg);
+
 	default:
 		return -ENOTTY;
 	}

-- 

"There are only two ways to live your life. One is as though nothing
 is a miracle. The other is as though everything is a miracle."
        - Albert Einstein

Joel Becker
Senior Member of Technical Staff
Oracle Corporation
E-mail: joel.becker@oracle.com
Phone: (650) 506-8127

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

end of thread, other threads:[~2002-06-02  2:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-06-01  6:43 [PATCH] Watchdog Stuff (1/4) Joel Becker
2002-06-01  7:04 ` [PATCH] Watchdog Stuff (2/4) Joel Becker
2002-06-01  7:05 ` [PATCH] Watchdog Stuff (3/4) Joel Becker
2002-06-01  7:06 ` [PATCH] Watchdog Stuff (4/4) Joel Becker
2002-06-01 18:24 ` [PATCH] Watchdog Stuff (1/4) Rob Radez
2002-06-02  2:28 ` Rob Radez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox