kernel-ark/drivers/usb/core
Inaky Perez-Gonzalez dc023dceec USB: Introduce usb_queue_reset() to do resets from atomic contexts
This patch introduces a new call to be able to do a USB reset from an
atomic contect. This is quite helpful in USB callbacks to handle
errors (when the only thing that can be done is to do a device
reset).

It is done queuing a work struct that will do the actual reset. The
struct is "attached" to an interface so pending requests from an
interface are removed when said interface is unbound from the driver.

The call flow then becomes:

usb_queue_reset_device()
  __usb_queue_reset_device() [workqueue]
    usb_reset_device()

usb_probe_interface()
  usb_cancel_queue_reset()      [error path]

usb_unbind_interface()
  usb_cancel_queue_reset()

usb_driver_release_interface()
  usb_cancel_queue_reset()

Note usb_cancel_queue_reset() needs smarts to try not to unqueue when
it is actually being executed. This happens when we run the reset from
the workqueue: usb_reset_device() is called and on interface unbind
time, usb_cancel_queue_reset() would be called. That would deadlock on
cancel_work_sync(). To avoid that, we set (before running
usb_reset_device()) usb_intf->reset_running and clear it inmediately
after returning.

Patch is against 2.6.28-rc2 and depends on
http://marc.info/?l=linux-usb&m=122581634925308&w=2 (as submitted by
Alan Stern).

Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-01-07 09:59:53 -08:00
..
buffer.c
config.c
devices.c usb: hub: add check for unsupported bus topology 2008-07-21 15:16:26 -07:00
devio.c USB: Remove restrictions on signal numbers in devio.c 2009-01-07 09:59:51 -08:00
driver.c USB: Introduce usb_queue_reset() to do resets from atomic contexts 2009-01-07 09:59:53 -08:00
endpoint.c USB: remove err() macro from usb core code 2008-10-17 14:41:11 -07:00
file.c USB: remove err() macro from usb core code 2008-10-17 14:41:11 -07:00
generic.c USB: fix possible deadlock involving sysfs attributes 2008-05-29 13:59:03 -07:00
hcd-pci.c
hcd.c USB: fix crash when URBs are unlinked after the device is gone 2008-10-29 14:54:40 -07:00
hcd.h USB: protect hcd.h from multiple inclusions 2009-01-07 09:59:50 -08:00
hub.c USB: Introduce usb_queue_reset() to do resets from atomic contexts 2009-01-07 09:59:53 -08:00
hub.h
inode.c zero i_uid/i_gid on inode allocation 2009-01-05 11:54:28 -05:00
Kconfig usb core: fix USB_OTG_BLACKLIST_HUB typo 2008-10-17 14:40:54 -07:00
Makefile
message.c USB: Introduce usb_queue_reset() to do resets from atomic contexts 2009-01-07 09:59:53 -08:00
notify.c
otg_whitelist.h
quirks.c Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input 2008-06-17 18:10:40 -07:00
sysfs.c USB: straighten out inline code in sysfs.c 2009-01-07 09:59:50 -08:00
urb.c USB: mention URB_FREE_BUFFER in usb_free_urb documentation 2008-11-13 14:45:02 -08:00
usb.c USB: add asynchronous autosuspend/autoresume support 2009-01-07 09:59:53 -08:00
usb.h USB: add asynchronous autosuspend/autoresume support 2009-01-07 09:59:53 -08:00