Skip to content

Commit

Permalink
USB: cdc-wdm: reset handling according to new requirements
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Oliver Neukum authored and Greg Kroah-Hartman committed Apr 30, 2011
1 parent b4026c4 commit d771d8a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions drivers/usb/class/cdc-wdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,8 @@ static int wdm_open(struct inode *inode, struct file *file)

mutex_lock(&desc->lock);
if (!desc->count++) {
desc->werr = 0;
desc->rerr = 0;
rv = usb_submit_urb(desc->validity, GFP_KERNEL);
if (rv < 0) {
desc->count--;
Expand Down Expand Up @@ -853,6 +855,18 @@ static int wdm_pre_reset(struct usb_interface *intf)
struct wdm_device *desc = usb_get_intfdata(intf);

mutex_lock(&desc->lock);
kill_urbs(desc);

/*
* we notify everybody using poll of
* an exceptional situation
* must be done before recovery lest a spontaneous
* message from the device is lost
*/
spin_lock_irq(&desc->iuspin);
desc->rerr = -EINTR;
spin_unlock_irq(&desc->iuspin);
wake_up_all(&desc->wait);
return 0;
}

Expand Down

0 comments on commit d771d8a

Please sign in to comment.