patch-2.4.0-test3 linux/drivers/pnp/isapnp_proc.c

Next file: linux/drivers/sbus/audio/audio.c
Previous file: linux/drivers/pnp/isapnp.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.0-test2/linux/drivers/pnp/isapnp_proc.c linux/drivers/pnp/isapnp_proc.c
@@ -28,6 +28,7 @@
 #include <linux/poll.h>
 #include <linux/vmalloc.h>
 #include <asm/uaccess.h>
+#include <linux/smp_lock.h>
 #include <linux/isapnp.h>
 
 struct isapnp_info_buffer {
@@ -169,11 +170,12 @@
 		kfree(buffer);
 		return -ENOMEM;
 	}
+	lock_kernel();
 	buffer->curr = buffer->buffer;
 	file->private_data = buffer;
-	MOD_INC_USE_COUNT;
 	if (mode == O_RDONLY)
 		isapnp_info_read(buffer);
+	unlock_kernel();
 	return 0;
 }
 
@@ -189,7 +191,6 @@
 		isapnp_info_write(buffer);
 	vfree(buffer->buffer);
 	kfree(buffer);
-	MOD_DEC_USE_COUNT;
 	return 0;
 }
 
@@ -286,6 +287,7 @@
 	if (!e)
 		return -ENOMEM;
 	e->proc_fops = &isapnp_proc_bus_file_operations;
+	e->owner = THIS_MODULE;
 	e->data = dev;
 	e->size = 256;
 	return 0;
@@ -367,8 +369,10 @@
 
 	isapnp_proc_entry = NULL;
 	p = create_proc_entry("isapnp", S_IFREG | S_IRUGO | S_IWUSR, &proc_root);
-	if (p)
+	if (p) {
 		p->proc_fops = &isapnp_info_entry_operations;
+		p->owner = THIS_MODULE;
+	}
 	isapnp_proc_entry = p;
 	isapnp_proc_bus_dir = proc_mkdir("isapnp", proc_bus);
 	isapnp_proc_devices_entry = create_proc_info_entry("devices", 0,

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