diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 12:25:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-23 12:25:16 -0400 |
commit | be90a49ca22a95f184d9f32d35b5247b44032849 (patch) | |
tree | d3c2edc18c003c384366f57901616ac29c80bc27 /drivers/usb/serial/usb-serial.c | |
parent | 1f0918d03ff4b5c94540c71ce889672abdbc2f4a (diff) | |
parent | a87371b477774b290c27bc5cb7f4ccc5379574a9 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6: (142 commits)
USB: Fix sysfs paths in documentation
USB: skeleton: fix coding style issues.
USB: O_NONBLOCK in read path of skeleton
USB: make usb-skeleton honor O_NONBLOCK in write path
USB: skel_read really sucks royally
USB: Add hub descriptor update hook for xHCI
USB: xhci: Support USB hubs.
USB: xhci: Set multi-TT field for LS/FS devices under hubs.
USB: xhci: Set route string for all devices.
USB: xhci: Fix command wait list handling.
USB: xhci: Change how xHCI commands are handled.
USB: xhci: Refactor input device context setup.
USB: xhci: Endpoint representation refactoring.
USB: gadget: ether needs to select CRC32
USB: fix USBTMC get_capabilities success handling
USB: fix missing error check in probing
USB: usbfs: add USBDEVFS_URB_BULK_CONTINUATION flag
USB: support for autosuspend in sierra while online
USB: ehci-dbgp,ehci: Allow dbpg to work with suspend/resume
USB: ehci-dbgp,documentation: Documentation updates for ehci-dbgp
...
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); |