• E
    sierra: driver urb handling improvements · b9a44bc1
    Elina Pasheva 提交于
    [Folded from eight patches into one as the original set according to the
     author "All of the patches need to be applied to obtain a working product"
     so keeping them split seems unhelpful
    
     Merge fixes done versus other conflicting changes and moved the
     spin_lock_init from open to setup time -- Alan]
    
    Summary of the changes and code re-organization in this patch:
    
    - The memory for urbs is allocated and urbs are submitted only for the active
      interfaces (instead of pre-allocating these for all interfaces). This will
      save memory especially in the case of using composite devices.
    - The code has been re-organized and functionality has been extracted from
      sierra_startup(), sierra_shutdown(), sierra_open(), sierra_close() and added
      in helper functions sierra_release_urb(), sierra_stop_rx_urbs(),
      sierra_submit_rx_urbs() and sierra_setup_urb()
    
    - Added function sierra_release_urb() to free an urb and its transfer
    buffer.
    - Removed unecessary include file reference and comment.
    - Added function sierra_stop_rx_urbs() that takes care of the release of
    receive and interrupt urbs. This function is to be called by sierra_close()
    whenever an interface is de-activated.
    - Added new function sierra_submit_rx_urbs() that handles the submission of
    receive urbs and interrupt urbs (if any) during the interface activation.
    This function is to be called by sierra_open(). Added a second parameter to
    pass the memory allocation (as suggested by Oliver Neukum) so that this
    function can be used in post_reset() and resume().
    - Added new function sierra_setup_urb() that contains the functionality to
    allocate an urb, fill bulk urb using the supplied memory allocation flag
    and release urb upon error. Added parameter so that the caller pass the
    memory allocation flag for flexibility.
    - Moved sierra_close() before sierra_open() to resolve dependencies
    introduced by the code reorganization.
    - Modified sierra_close() to call sierra_stop_rx_urbs() and
    sierra_release_urb() functions added in previous patch.
    - Modified sierra_open() to call sierra_setup_urb() and sierra_submit_rx_urbs()
    functions; note urbs are allocated and submitted for each activated interface.
    - Modified sierra_startup() so that allocation of urbs happens whenever an
    interface is activated (urb allocation is moved to sierra_open()).
    - Modified sierra_shutdown() so that urbs are freed whenever an interface is
    de-activated (urb freeing moved to sierra_close() as shown in previous patch
    from the series)
    - Removed unecessary data structure from sierra_port_private_data
    - Suppress an entry in logs by not re-submitting an urb when usb_submit_urb()
    returns -EPERM, as this shows that usb_kill_urb() is running (as suggested by
    Oliver Neukum)
    Signed-off-by: NElina Pasheva <epasheva@sierrawireless.com>
    Signed-off-by: NAlan Cox <alan.cox@linux.intel.com>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    b9a44bc1
sierra.c 22.9 KB