• Alan Stern's avatar
    [PATCH] USB: Add usb_kill_urb() · 1d92d8c6
    Alan Stern authored
    This patch is a slightly revised version of as277c, updated to match the
    current source.  The only difference from the older version is that this
    makes urb->use_count into an atomic_t, to avoid the overhead of an extra
    locking step each time an URB is submitted and given back.  The important
    features of this patch are:
    
    	-EPERM added to Documentation/usb/error-codes.txt.
    
    	Failure to use URB_ASYNC_UNLINK with usb_unlink_urb() is
    	deprecated in the documentation.
    
    	New ->reject and ->use_count fields added to struct urb.
    	The reject field is protected by urb->lock, and locking is
    	required only in usb_kill_urb() which doesn't have to be fast.
    
    	Single wait_queue used for all processes waiting inside
    	usb_kill_urb().  The wait queue is woken up only when an URB
    	is given back with ->reject set.
    
    	usb_rh_status_dequeue() changed to return int.  It looks like
    	this function should be declared static; it's not used outside
    	the hcd.c file.
    
    	Prototype for unlink_urb() in struct usb_operations is changed
    	to include a status code argument.  This is necessary so that
    	the different unlink paths can return -ENOENT and -ECONNRESET
    	as appropriate.
    
    	Support for synchronous usb_unlink_urb() has been removed;
    	such calls are passed to usb_kill_urb().
    
    	Kerneldoc for usb_unlink_urb() is updated.
    
    	usb_kill_urb() added to urb.c.
    
    	hc_simple() host driver is partially updated -- it should
    	compile but it won't really work right.
    Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
    Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
    1d92d8c6
urb.c 17.7 KB