patch-2.3.99-pre6 linux/drivers/usb/devices.c

Next file: linux/drivers/usb/devio.c
Previous file: linux/drivers/usb/dc2xx.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.99-pre5/linux/drivers/usb/devices.c linux/drivers/usb/devices.c
@@ -54,6 +54,7 @@
 #include <linux/slab.h>
 #include <linux/poll.h>
 #include <linux/usb.h>
+#include <linux/smp_lock.h>
 #include <linux/usbdevice_fs.h>
 #include <asm/uaccess.h>
 
@@ -452,11 +453,13 @@
 	return ret;
 }
 
+/* Kernel lock for "lastev" protection */
 static unsigned int usb_device_poll(struct file *file, struct poll_table_struct *wait)
 {
 	struct usb_device_status *st = (struct usb_device_status *)file->private_data;
 	unsigned int mask = 0;
-	
+
+	lock_kernel();
 	if (!st) {
 		st = kmalloc(sizeof(struct usb_device_status), GFP_KERNEL);
 		if (!st)
@@ -475,6 +478,7 @@
 	if (st->lastev != conndiscevcnt)
 		mask |= POLLIN;
 	st->lastev = conndiscevcnt;
+	unlock_kernel();
 	return mask;
 }
 
@@ -494,7 +498,7 @@
         return 0;
 }
 
-static long long usb_device_lseek(struct file * file, long long offset, int orig)
+static loff_t usb_device_lseek(struct file * file, loff_t offset, int orig)
 {
 	switch (orig) {
 	case 0:

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