patch-2.1.56 linux/drivers/char/pcwd.c

Next file: linux/drivers/char/psaux.c
Previous file: linux/drivers/char/pc110pad.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.55/linux/drivers/char/pcwd.c linux/drivers/char/pcwd.c
@@ -28,6 +28,7 @@
  *              drivers to panic the system if it's overheating at bootup.
  * 961118	Changed some verbiage on some of the output, tidied up
  *		code bits, and added compatibility to 2.1.x.
+ * 970912       Enabled board on open and disable on close.
  */
 
 #include <linux/module.h>
@@ -209,9 +210,6 @@
 {
 	int wdrst_stat;
 
-	if (!is_open)
-		return;
-
 	wdrst_stat = inb_p(current_readport);
 	wdrst_stat &= 0x0F;
 
@@ -373,7 +371,13 @@
 
 static int pcwd_open(struct inode *ino, struct file *filep)
 {
+	if (is_open)
+		return -EIO;
 	MOD_INC_USE_COUNT;
+	/*  Enable the port  */
+	if (revision == PCWD_REVISION_C)
+		outb_p(0x00, current_readport + 3);
+	is_open = 1;
 	return(0);
 }
 
@@ -397,7 +401,15 @@
 
 static int pcwd_close(struct inode *ino, struct file *filep)
 {
+	is_open = 0;
 	MOD_DEC_USE_COUNT;
+#ifndef CONFIG_WATCHDOG_NOWAYOUT
+	/*  Disable the board  */
+	if (revision == PCWD_REVISION_C) {
+		outb_p(0xA5, current_readport + 3);
+		outb_p(0xA5, current_readport + 3);
+	}
+#endif
 	return 0;
 }
 
@@ -531,8 +543,6 @@
 	}
 #endif
 
-	is_open = 1;
-
 #ifdef	PCWD_BLIND
 	current_readport = PCWD_BLIND;
 #endif
@@ -571,6 +581,11 @@
 #ifdef	MODULE
 void cleanup_module(void)
 {
+	/*  Disable the board  */
+	if (revision == PCWD_REVISION_C) {
+		outb_p(0xA5, current_readport + 3);
+		outb_p(0xA5, current_readport + 3);
+	}
 	misc_deregister(&pcwd_miscdev);
 	if (supports_temp)
 		misc_deregister(&temp_miscdev);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov