diff options
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r-- | drivers/usb/serial/usb-serial.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 9d7ca4868d37..ff75a3589e7e 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/serial.h> | 35 | #include <linux/serial.h> |
36 | #include <linux/usb.h> | 36 | #include <linux/usb.h> |
37 | #include <linux/usb/serial.h> | 37 | #include <linux/usb/serial.h> |
38 | #include <linux/kfifo.h> | ||
38 | #include "pl2303.h" | 39 | #include "pl2303.h" |
39 | 40 | ||
40 | /* | 41 | /* |
@@ -292,8 +293,6 @@ static int serial_open(struct tty_struct *tty, struct file *filp) | |||
292 | static void serial_down(struct usb_serial_port *port) | 293 | static void serial_down(struct usb_serial_port *port) |
293 | { | 294 | { |
294 | struct usb_serial_driver *drv = port->serial->type; | 295 | struct usb_serial_driver *drv = port->serial->type; |
295 | struct usb_serial *serial; | ||
296 | struct module *owner; | ||
297 | 296 | ||
298 | /* | 297 | /* |
299 | * The console is magical. Do not hang up the console hardware | 298 | * The console is magical. Do not hang up the console hardware |
@@ -309,12 +308,8 @@ static void serial_down(struct usb_serial_port *port) | |||
309 | return; | 308 | return; |
310 | 309 | ||
311 | mutex_lock(&port->mutex); | 310 | mutex_lock(&port->mutex); |
312 | serial = port->serial; | ||
313 | owner = serial->type->driver.owner; | ||
314 | |||
315 | if (drv->close) | 311 | if (drv->close) |
316 | drv->close(port); | 312 | drv->close(port); |
317 | |||
318 | mutex_unlock(&port->mutex); | 313 | mutex_unlock(&port->mutex); |
319 | } | 314 | } |
320 | 315 | ||
@@ -631,6 +626,8 @@ static void port_release(struct device *dev) | |||
631 | usb_free_urb(port->write_urb); | 626 | usb_free_urb(port->write_urb); |
632 | usb_free_urb(port->interrupt_in_urb); | 627 | usb_free_urb(port->interrupt_in_urb); |
633 | usb_free_urb(port->interrupt_out_urb); | 628 | usb_free_urb(port->interrupt_out_urb); |
629 | if (!IS_ERR(port->write_fifo) && port->write_fifo) | ||
630 | kfifo_free(port->write_fifo); | ||
634 | kfree(port->bulk_in_buffer); | 631 | kfree(port->bulk_in_buffer); |
635 | kfree(port->bulk_out_buffer); | 632 | kfree(port->bulk_out_buffer); |
636 | kfree(port->interrupt_in_buffer); | 633 | kfree(port->interrupt_in_buffer); |
@@ -970,6 +967,10 @@ int usb_serial_probe(struct usb_interface *interface, | |||
970 | dev_err(&interface->dev, "No free urbs available\n"); | 967 | dev_err(&interface->dev, "No free urbs available\n"); |
971 | goto probe_error; | 968 | goto probe_error; |
972 | } | 969 | } |
970 | port->write_fifo = kfifo_alloc(PAGE_SIZE, GFP_KERNEL, | ||
971 | &port->lock); | ||
972 | if (IS_ERR(port->write_fifo)) | ||
973 | goto probe_error; | ||
973 | buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); | 974 | buffer_size = le16_to_cpu(endpoint->wMaxPacketSize); |
974 | port->bulk_out_size = buffer_size; | 975 | port->bulk_out_size = buffer_size; |
975 | port->bulk_out_endpointAddress = endpoint->bEndpointAddress; | 976 | port->bulk_out_endpointAddress = endpoint->bEndpointAddress; |
@@ -1163,15 +1164,19 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message) | |||
1163 | 1164 | ||
1164 | serial->suspending = 1; | 1165 | serial->suspending = 1; |
1165 | 1166 | ||
1167 | if (serial->type->suspend) { | ||
1168 | r = serial->type->suspend(serial, message); | ||
1169 | if (r < 0) | ||
1170 | goto err_out; | ||
1171 | } | ||
1172 | |||
1166 | for (i = 0; i < serial->num_ports; ++i) { | 1173 | for (i = 0; i < serial->num_ports; ++i) { |
1167 | port = serial->port[i]; | 1174 | port = serial->port[i]; |
1168 | if (port) | 1175 | if (port) |
1169 | kill_traffic(port); | 1176 | kill_traffic(port); |
1170 | } | 1177 | } |
1171 | 1178 | ||
1172 | if (serial->type->suspend) | 1179 | err_out: |
1173 | r = serial->type->suspend(serial, message); | ||
1174 | |||
1175 | return r; | 1180 | return r; |
1176 | } | 1181 | } |
1177 | EXPORT_SYMBOL(usb_serial_suspend); | 1182 | EXPORT_SYMBOL(usb_serial_suspend); |