Rather than taking the semaphore dev->serialize in the top-level ioctl handler, usbdev_ioctl, push it down to the individual ioctl routines. This is a Good Thing because the ioctl routines do plenty of copy_to/from_user calls. It's better to acquire the semaphore after copying the data from the user, and release it before copying the result back, rather than the other way round (which is currently the case). This requires pushing the semaphore down into the individual routines.
Each of the following patches moves the semaphore acquisition down into an ioctl routine, after any copy_from_user calls, and likewise releases it before any copy_to_user stuff. Patches 16/18 and 17/18 (proc_control and proc_bulk) also release the semaphore while waiting for the urb to complete. This fixes http://bugme.osdl.org/show_bug.cgi?id=3108. You may well wonder why I copied some of the usb_start_wait_urb infrastructure from messages.c. Good question! There are two reasons that I recall. The first is that if you use usb_start_wait_urb, then you are obliged to drop the semaphore before calling it. But the device might get disconnected, or the configuration may change, between your dropping the semaphore and the actual urb submission in usb_start_wait_urb. That's probably not the end of the world, but I'd rather avoid those kinds of hassles. Another reason is that I'd like to see if I can make the waiting interruptible. Having the waiting logic in devio.c means (hopefully) that I can muck around with it without borking the rest of the USB subsystem. Patch 18/18 is for proc_submit_urb, and will be sent later. It's by far the most complicated patch, and I'd like to test it some more before sending it. Once patch 1/18 is applied, the other patches should all be independent of each other, except that 17/18 depends on 16/18. Ciao, Duncan. ------------------------------------------------------- This SF.Net email is sponsored by OSTG. Have you noticed the changes on Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now, one more big change to announce. We are now OSTG- Open Source Technology Group. Come see the changes on the new OSTG site. www.ostg.com _______________________________________________ [EMAIL PROTECTED] To unsubscribe, use the last form field at: https://lists.sourceforge.net/lists/listinfo/linux-usb-devel