On Thu, 25 Mar 2004 16:44:42 -0800 Greg KH <[EMAIL PROTECTED]> wrote:
> > > Except that you forgot to initialise the semaphore. > > > > Now actually with a patch for 2.4. > > How about a patch for 2.6? > greg k-h I'm not up to speed with 2.6, however try the attached forward port, please. -- Pete diff -upr -X dontdiff linux-2.6.5-rc1/drivers/usb/class/usblp.c linux-2.6.5-rc1-wacom/drivers/usb/class/usblp.c --- linux-2.6.5-rc1/drivers/usb/class/usblp.c 2004-03-14 15:44:28.000000000 -0800 +++ linux-2.6.5-rc1-wacom/drivers/usb/class/usblp.c 2004-03-19 11:32:43.000000000 -0800 @@ -219,6 +219,8 @@ static int usblp_cache_device_id_string( /* forward reference to make our lives easier */ extern struct usb_driver usblp_driver; +static DECLARE_MUTEX(usblp_sem); /* locks the existence of usblp's. */ + /* * Functions for usblp control messages. */ @@ -329,7 +331,7 @@ static int usblp_open(struct inode *inod if (minor < 0) return -ENODEV; - lock_kernel(); + down (&usblp_sem); retval = -ENODEV; intf = usb_find_interface(&usblp_driver, minor); @@ -375,7 +377,7 @@ static int usblp_open(struct inode *inod } } out: - unlock_kernel(); + up (&usblp_sem); return retval; } @@ -405,13 +407,13 @@ static int usblp_release(struct inode *i { struct usblp *usblp = file->private_data; - down (&usblp->sem); + down (&usblp_sem); usblp->used = 0; if (usblp->present) { usblp_unlink_urbs(usblp); - up(&usblp->sem); } else /* finish cleanup from disconnect */ usblp_cleanup (usblp); + up (&usblp_sem); return 0; } @@ -1123,18 +1125,17 @@ static void usblp_disconnect(struct usb_ BUG (); } + down (&usblp_sem); down (&usblp->sem); - lock_kernel(); usblp->present = 0; usb_set_intfdata (intf, NULL); usblp_unlink_urbs(usblp); + up (&usblp->sem); if (!usblp->used) usblp_cleanup (usblp); - else /* cleanup later, on release */ - up (&usblp->sem); - unlock_kernel(); + up (&usblp_sem); } static struct usb_device_id usblp_ids [] = { ------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel