• Torrey Hoffman's avatar
    [PATCH] USB: fix race in ati_remote and small cleanup · befe2d08
    Torrey Hoffman authored
    On Thu, 2004-03-18 at 07:44, Oliver Neukum wrote:
    > Hi,
    >
    > you must use set_current_state() only after usb_submit_urb() with GFP_KERNEL
    > as second argument, because it may sleep to allocate memory and is woken up
    > resetting the state to TASK_RUNNING. In that case you had a busy polling loop.
    > Furthermore, always use wake_up unconditionally. It checkes anyway.
    
    Thanks for reviewing this code, I'm new to Linux driver development and
    more eyes on my work is a good thing.   I've actually been working on
    some more cleanups to the driver to fix the race between open and
    disconnect, and was just about to send it in...
    
    So, the attached patch against 2.6.5-rc1-mm1 includes a mutex to lock
    the open/disconnect paths, modelled after the usb-skeleton driver. It
    includes Oliver Neukum's fixes and other cleanups as well.
    befe2d08
ati_remote.c 26.8 KB