public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joel Becker <Joel.Becker@oracle.com>
To: linux-kernel@vger.kernel.org
Cc: Rob Radez <rob@osinvestor.com>,
	Matt Domsch <Matt_Domsch@dell.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>
Subject: [PATCH] Watchdog Stuff (1/4)
Date: Fri, 31 May 2002 23:43:36 -0700	[thread overview]
Message-ID: <20020601064309.GA10222@insight.us.oracle.com> (raw)

	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

             reply	other threads:[~2002-06-01  6:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-01  6:43 Joel Becker [this message]
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

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=20020601064309.GA10222@insight.us.oracle.com \
    --to=joel.becker@oracle.com \
    --cc=Matt_Domsch@dell.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rob@osinvestor.com \
    /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