patch-2.4.0-test4 linux/drivers/char/wdt977.c

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

diff -u --recursive --new-file v2.4.0-test3/linux/drivers/char/wdt977.c linux/drivers/char/wdt977.c
@@ -20,6 +20,7 @@
 #include <linux/fs.h>
 #include <linux/miscdevice.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 
 #include <asm/io.h>
 #include <asm/system.h>
@@ -38,7 +39,9 @@
 {
 	if(timer_alive)
 		return -EBUSY;
+#ifdef CONFIG_WATCHDOG_NOWAYOUT
 	MOD_INC_USE_COUNT;
+#endif
 	timer_alive++;
 
 	//max timeout value = 255 minutes (0xFF). Write 0 to disable WatchDog.
@@ -88,6 +91,7 @@
 	 * 	Lock it in if it's a module and we defined ...NOWAYOUT
 	 */
 #ifndef CONFIG_WATCHDOG_NOWAYOUT
+	lock_kernel();
 
 	// unlock the SuperIO chip
 	outb(0x87,0x370); 
@@ -118,8 +122,8 @@
 	// lock the SuperIO chip
 	outb(0xAA,0x370);
 
-	MOD_DEC_USE_COUNT;
 	timer_alive=0;
+	unlock_kernel();
 
 	printk(KERN_INFO "Watchdog: shutdown.\n");
 #endif
@@ -162,6 +166,7 @@
 
 static struct file_operations wdt977_fops=
 {
+	owner:		THIS_MODULE,
 	write:		wdt977_write,
 	open:		wdt977_open,
 	release:	wdt977_release,

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)