• David Brownell's avatar
    [PATCH] USB: track usb ch9 device state · b3dca131
    David Brownell authored
    This patch merges the USB state definitions from the ARM Linux
    code (inside the sa1100 driver) and uses them to track what can
    be done with the device.  That replaces the recently added
    "udev->present" flag with a more complete/standard state model.
    
    There are a few changes that might affect behavior if things
    start to go really haywire:
    
     - usb_set_address() and usb_set_configuration(), used while
       enumerating, handle some unlikely cases more correctly:
       don't allow setting address to zero (undefined behavior),
       and do allow un-configuring (config 0).  (Adds a FIXME
       for an existing set-configuration bug too.)
    
     - usb_disconnect() flags the state change earlier (as soon
       as it's known).
    
     - usb_submit_urb() works in the states where messaging is
       allowed, and also enforces the "unless configured, only
       control traffic is legal" rule.
    
     - usb_unlink_urb() doesn't care any more about that state.
       (There seemed to be agreement that it must not matter.)
    
    This will help with some further cleanups in the complex of
    issues relating to driver removal, device removal, config
    changing (with driver unbind and rebind), reset, and so on.
    b3dca131
hub.c 33.4 KB