aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/serial/generic.c24
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 927c5d6a255e..131d6cbeefee 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -104,24 +104,20 @@ EXPORT_SYMBOL_GPL(usb_serial_generic_open);
104 104
105static void generic_cleanup(struct usb_serial_port *port) 105static void generic_cleanup(struct usb_serial_port *port)
106{ 106{
107 struct usb_serial *serial = port->serial;
108 unsigned long flags; 107 unsigned long flags;
109 int i; 108 int i;
110 109
111 if (serial->dev) { 110 if (port->bulk_out_size) {
112 /* shutdown any bulk transfers that might be going on */ 111 for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i)
113 if (port->bulk_out_size) { 112 usb_kill_urb(port->write_urbs[i]);
114 for (i = 0; i < ARRAY_SIZE(port->write_urbs); ++i)
115 usb_kill_urb(port->write_urbs[i]);
116 113
117 spin_lock_irqsave(&port->lock, flags); 114 spin_lock_irqsave(&port->lock, flags);
118 kfifo_reset_out(&port->write_fifo); 115 kfifo_reset_out(&port->write_fifo);
119 spin_unlock_irqrestore(&port->lock, flags); 116 spin_unlock_irqrestore(&port->lock, flags);
120 } 117 }
121 if (port->bulk_in_size) { 118 if (port->bulk_in_size) {
122 for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i) 119 for (i = 0; i < ARRAY_SIZE(port->read_urbs); ++i)
123 usb_kill_urb(port->read_urbs[i]); 120 usb_kill_urb(port->read_urbs[i]);
124 }
125 } 121 }
126} 122}
127 123