patch-2.4.0-test3 linux/drivers/isdn/hysdn/hysdn_procconf.c

Next file: linux/drivers/isdn/hysdn/hysdn_procfs.c
Previous file: linux/drivers/isdn/divert/divert_procfs.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test2/linux/drivers/isdn/hysdn/hysdn_procconf.c linux/drivers/isdn/hysdn/hysdn_procconf.c
@@ -45,6 +45,7 @@
 #include <linux/poll.h>
 #include <linux/proc_fs.h>
 #include <linux/pci.h>
+#include <linux/smp_lock.h>
 
 #include "hysdn_defs.h"
 
@@ -286,9 +287,8 @@
 	struct conf_writedata *cnf;
 	char *cp, *tmp;
 
-	MOD_INC_USE_COUNT;	/* lock module */
-
 	/* now search the addressed card */
+	lock_kernel();
 	card = card_root;
 	while (card) {
 		pd = card->procconf;
@@ -297,7 +297,7 @@
 		card = card->next;	/* search next entry */
 	}
 	if (!card) {
-		MOD_DEC_USE_COUNT;	/* unlock module */
+		unlock_kernel();
 		return (-ENODEV);	/* device is unknown/invalid */
 	}
 	if (card->debug_flags & (LOG_PROC_OPEN | LOG_PROC_ALL))
@@ -308,7 +308,7 @@
 		/* write only access -> write boot file or conf line */
 
 		if (!(cnf = kmalloc(sizeof(struct conf_writedata), GFP_KERNEL))) {
-			MOD_DEC_USE_COUNT;
+			unlock_kernel();
 			return (-EFAULT);
 		}
 		cnf->card = card;
@@ -320,7 +320,7 @@
 		/* read access -> output card info data */
 
 		if (!(tmp = (char *) kmalloc(INFO_OUT_LEN * 2 + 2, GFP_KERNEL))) {
-			MOD_DEC_USE_COUNT;
+			unlock_kernel();
 			return (-EFAULT);	/* out of memory */
 		}
 		filep->private_data = tmp;	/* start of string */
@@ -354,9 +354,10 @@
 		*cp++ = '\n';
 		*cp = 0;	/* end of string */
 	} else {		/* simultaneous read/write access forbidden ! */
-		MOD_DEC_USE_COUNT;	/* unlock module */
+		unlock_kernel();
 		return (-EPERM);	/* no permission this time */
 	}
+	unlock_kernel();
 	return (0);
 }				/* hysdn_conf_open */
 
@@ -402,7 +403,6 @@
 		if (filep->private_data)
 			kfree(filep->private_data);	/* release memory */
 	}
-	MOD_DEC_USE_COUNT;	/* reduce usage count */
 	return (retval);
 }				/* hysdn_conf_close */
 
@@ -447,6 +447,7 @@
 					     S_IFREG | S_IRUGO | S_IWUSR,
 					    hysdn_proc_entry)) != NULL) {
 			((struct proc_dir_entry *) card->procconf)->proc_fops = &conf_fops;
+			((struct proc_dir_entry *) card->procconf)->owner = THIS_MODULE;
 			hysdn_proclog_init(card);	/* init the log file entry */
 		}
 		card = card->next;	/* next entry */

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