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

Next file: linux/drivers/i2c/i2c-dev.c
Previous file: linux/drivers/char/wdt977.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test3/linux/drivers/char/wdt_pci.c linux/drivers/char/wdt_pci.c
@@ -51,6 +51,7 @@
 #include <linux/notifier.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
+#include <linux/smp_lock.h>
 
 #include <linux/pci.h>
 
@@ -358,7 +359,9 @@
 		case WATCHDOG_MINOR:
 			if(wdt_is_open)
 				return -EBUSY;
+#ifdef CONFIG_WATCHDOG_NOWAYOUT	
 			MOD_INC_USE_COUNT;
+#endif
 			/*
 			 *	Activate 
 			 */
@@ -391,7 +394,6 @@
 			outb_p(0, WDT_DC);	/* Enable */
 			return 0;
 		case TEMP_MINOR:
-			MOD_INC_USE_COUNT;
 			return 0;
 		default:
 			return -ENODEV;
@@ -414,13 +416,14 @@
 {
 	if(MINOR(inode->i_rdev)==WATCHDOG_MINOR)
 	{
+		lock_kernel();
 #ifndef CONFIG_WATCHDOG_NOWAYOUT	
 		inb_p(WDT_DC);		/* Disable counters */
 		wdtpci_ctr_load(2,0);	/* 0 length reset pulses now */
 #endif		
 		wdt_is_open=0;
+		unlock_kernel();
 	}
-	MOD_DEC_USE_COUNT;
 	return 0;
 }
 
@@ -454,6 +457,7 @@
  
  
 static struct file_operations wdtpci_fops = {
+	owner:		THIS_MODULE,
 	llseek:		wdtpci_llseek,
 	read:		wdtpci_read,
 	write:		wdtpci_write,

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