-
David Brownell authored
This is an update to some patches from the December/January timeframe, which will help sort out some of the mess for drivers that need to use the reset logic. It's one of the last significant patches in my gadget-2.6 tree that haven't yet been merged into the main kernel tree. More refactoring of the enumeration code paths: * The first half of usb_new_device() becomes the second half of a new hub_port_init() routine (resets, sets address, gets descriptor) * The middle chunk of hub_port_connect_change() becomes the first half of that new hub_port_init() routine. * Khubd uses that new routine in hub_port_connect_change(). * Now usb_new_device() cleans up better after faults, and has a more useful locking policy (caller owns dev->serialize). * Has related minor cleanups including commenting some of the curious request sequences coming from khubd. Refactoring means a lot of the current usb_reset_device() logic won't need to stay an imperfect clone of the enumeration code ... soon, it can just call hub_port_init(). Even without touching usb_reset_device(), this eliminates a deadlock. Previously, address0_sem was used both during probe and during reset, so probe routines can't implement DFU firmware download (involves a reset; DFU also uncovers other problems) or safely recover from probe faults by resetting (usb-storage can try that). Now that lock is no longer held during probe(); so those deadlocks are gone. (And some drivers, like at76c503, can start to remove ugly workarounds.)
f0b314c4