aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/class/cdc-wdm.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/usb/class/cdc-wdm.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/usb/class/cdc-wdm.c')
-rw-r--r--drivers/usb/class/cdc-wdm.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c
index 094c76b5de17..2b9ff518b509 100644
--- a/drivers/usb/class/cdc-wdm.c
+++ b/drivers/usb/class/cdc-wdm.c
@@ -281,7 +281,7 @@ static void cleanup(struct wdm_device *desc)
281 desc->sbuf, 281 desc->sbuf,
282 desc->validity->transfer_dma); 282 desc->validity->transfer_dma);
283 usb_free_coherent(interface_to_usbdev(desc->intf), 283 usb_free_coherent(interface_to_usbdev(desc->intf),
284 desc->wMaxCommand, 284 desc->bMaxPacketSize0,
285 desc->inbuf, 285 desc->inbuf,
286 desc->response->transfer_dma); 286 desc->response->transfer_dma);
287 kfree(desc->orq); 287 kfree(desc->orq);
@@ -342,7 +342,7 @@ static ssize_t wdm_write
342 goto outnp; 342 goto outnp;
343 } 343 }
344 344
345 if (!file->f_flags && O_NONBLOCK) 345 if (!(file->f_flags & O_NONBLOCK))
346 r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE, 346 r = wait_event_interruptible(desc->wait, !test_bit(WDM_IN_USE,
347 &desc->flags)); 347 &desc->flags));
348 else 348 else
@@ -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--;
@@ -584,7 +586,8 @@ static const struct file_operations wdm_fops = {
584 .open = wdm_open, 586 .open = wdm_open,
585 .flush = wdm_flush, 587 .flush = wdm_flush,
586 .release = wdm_release, 588 .release = wdm_release,
587 .poll = wdm_poll 589 .poll = wdm_poll,
590 .llseek = noop_llseek,
588}; 591};
589 592
590static struct usb_class_driver wdm_class = { 593static struct usb_class_driver wdm_class = {
@@ -852,6 +855,18 @@ static int wdm_pre_reset(struct usb_interface *intf)
852 struct wdm_device *desc = usb_get_intfdata(intf); 855 struct wdm_device *desc = usb_get_intfdata(intf);
853 856
854 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);
855 return 0; 870 return 0;
856} 871}
857 872