[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-usb
Subject: [PATCH] cdc-wdm: reset handling according to new requirements
From: Oliver Neukum <oneukum () suse ! de>
Date: 2011-04-29 12:12:21
Message-ID: 201104291412.21807.oneukum () suse ! de
[Download RAW message or body]
From d120bd06c2ced8757a1b5e30c3d7b3ec9486bab0 Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oliver@neukum.org>
Date: Fri, 29 Apr 2011 13:52:20 +0200
Subject: [PATCH] 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>
---
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 a97c018..2b9ff51 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)
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--;
@@ -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;
}
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic