diff options
author | Oliver Neukum <oliver@neukum.org> | 2011-04-29 08:12:21 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-04-29 20:04:40 -0400 |
commit | d771d8aa37805f5bf75808b12b737f39ee97f5d4 (patch) | |
tree | bd491a31ffc2803d78b45fa23b7c347a35af717f | |
parent | b4026c4584cd70858d4d3450abfb1cd0714d4f32 (diff) |
USB: cdc-wdm: reset handling according to new requirements
This patch
- ensures no IO takes place during resets
- reports resets to user space
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/class/cdc-wdm.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index a97c018dd419..2b9ff518b509 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -542,6 +542,8 @@ static int wdm_open(struct inode *inode, struct file *file) | |||
542 | 542 | ||
543 | mutex_lock(&desc->lock); | 543 | mutex_lock(&desc->lock); |
544 | if (!desc->count++) { | 544 | if (!desc->count++) { |
545 | desc->werr = 0; | ||
546 | desc->rerr = 0; | ||
545 | rv = usb_submit_urb(desc->validity, GFP_KERNEL); | 547 | rv = usb_submit_urb(desc->validity, GFP_KERNEL); |
546 | if (rv < 0) { | 548 | if (rv < 0) { |
547 | desc->count--; | 549 | desc->count--; |
@@ -853,6 +855,18 @@ static int wdm_pre_reset(struct usb_interface *intf) | |||
853 | struct wdm_device *desc = usb_get_intfdata(intf); | 855 | struct wdm_device *desc = usb_get_intfdata(intf); |
854 | 856 | ||
855 | mutex_lock(&desc->lock); | 857 | mutex_lock(&desc->lock); |
858 | kill_urbs(desc); | ||
859 | |||
860 | /* | ||
861 | * we notify everybody using poll of | ||
862 | * an exceptional situation | ||
863 | * must be done before recovery lest a spontaneous | ||
864 | * message from the device is lost | ||
865 | */ | ||
866 | spin_lock_irq(&desc->iuspin); | ||
867 | desc->rerr = -EINTR; | ||
868 | spin_unlock_irq(&desc->iuspin); | ||
869 | wake_up_all(&desc->wait); | ||
856 | return 0; | 870 | return 0; |
857 | } | 871 | } |
858 | 872 | ||