diff options
author | Arjan Mels <arjan.mels@gmx.net> | 2011-05-20 23:25:46 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-06-07 12:28:41 -0700 |
commit | d3ac0778801708caecb2b172328064255a350432 (patch) | |
tree | 72899146455ec5605fa877d822d931918ba6e692 /drivers/staging/usbip/stub_rx.c | |
parent | c11c4eebdd75fc0f443a3f794a2ddc85afed1932 (diff) |
staging: usbip: bugfix prevent driver unbind
Implemented pre_reset and post_reset methods of the driver to prevent the
driver from being unbound upon a device reset. Because of this also the
asynchronous reset introduced to prevent a race condition is no longer necessary
(and sometimes causes problems, because it comes later then expected).
Signed-off-by: Arjan Mels <arjan.mels@gmx.net>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Takahiro Hirofuchi <hirofuchi@users.sourceforge.net>
Cc: Max Vozeler <max@vozeler.com>
Cc: usbip-devel <usbip-devel@lists.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/usbip/stub_rx.c')
-rw-r--r-- | drivers/staging/usbip/stub_rx.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/staging/usbip/stub_rx.c b/drivers/staging/usbip/stub_rx.c index a5c1fa1f043..bc57844600b 100644 --- a/drivers/staging/usbip/stub_rx.c +++ b/drivers/staging/usbip/stub_rx.c @@ -175,16 +175,18 @@ static int tweak_reset_device_cmd(struct urb *urb) dev_info(&urb->dev->dev, "usb_queue_reset_device\n"); /* - * usb_lock_device_for_reset caused a deadlock: it causes the driver - * to unbind. In the shutdown the rx thread is signalled to shut down - * but this thread is pending in the usb_lock_device_for_reset. - * - * Instead queue the reset. - * - * Unfortunatly an existing usbip connection will be dropped due to - * driver unbinding. + * With the implementation of pre_reset and post_reset the driver no + * longer unbinds. This allows the use of synchronous reset. */ - usb_queue_reset_device(sdev->interface); + + if (usb_lock_device_for_reset(sdev->udev, sdev->interface)<0) + { + dev_err(&urb->dev->dev, "could not obtain lock to reset device\n"); + return 0; + } + usb_reset_device(sdev->udev); + usb_unlock_device(sdev->udev); + return 0; } |