aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/serial/usb-serial.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/serial/usb-serial.c')
-rw-r--r--drivers/usb/serial/usb-serial.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c
index 0cb0d77dc429..353798631903 100644
--- a/drivers/usb/serial/usb-serial.c
+++ b/drivers/usb/serial/usb-serial.c
@@ -283,7 +283,10 @@ static void serial_close(struct tty_struct *tty, struct file * filp)
283 } 283 }
284 284
285 if (port->open_count == 0) { 285 if (port->open_count == 0) {
286 usb_autopm_put_interface(port->serial->interface); 286 mutex_lock(&port->serial->disc_mutex);
287 if (!port->serial->disconnected)
288 usb_autopm_put_interface(port->serial->interface);
289 mutex_unlock(&port->serial->disc_mutex);
287 module_put(port->serial->type->driver.owner); 290 module_put(port->serial->type->driver.owner);
288 } 291 }
289 292
@@ -505,7 +508,7 @@ static void port_release(struct device *dev)
505{ 508{
506 struct usb_serial_port *port = to_usb_serial_port(dev); 509 struct usb_serial_port *port = to_usb_serial_port(dev);
507 510
508 dbg ("%s - %s", __func__, dev->bus_id); 511 dbg ("%s - %s", __func__, dev_name(dev));
509 port_free(port); 512 port_free(port);
510} 513}
511 514
@@ -625,7 +628,7 @@ int usb_serial_probe(struct usb_interface *interface,
625 struct usb_endpoint_descriptor *bulk_out_endpoint[MAX_NUM_PORTS]; 628 struct usb_endpoint_descriptor *bulk_out_endpoint[MAX_NUM_PORTS];
626 struct usb_serial_driver *type = NULL; 629 struct usb_serial_driver *type = NULL;
627 int retval; 630 int retval;
628 int minor; 631 unsigned int minor;
629 int buffer_size; 632 int buffer_size;
630 int i; 633 int i;
631 int num_interrupt_in = 0; 634 int num_interrupt_in = 0;
@@ -938,8 +941,8 @@ int usb_serial_probe(struct usb_interface *interface,
938 port->dev.bus = &usb_serial_bus_type; 941 port->dev.bus = &usb_serial_bus_type;
939 port->dev.release = &port_release; 942 port->dev.release = &port_release;
940 943
941 snprintf (&port->dev.bus_id[0], sizeof(port->dev.bus_id), "ttyUSB%d", port->number); 944 dev_set_name(&port->dev, "ttyUSB%d", port->number);
942 dbg ("%s - registering %s", __func__, port->dev.bus_id); 945 dbg ("%s - registering %s", __func__, dev_name(&port->dev));
943 retval = device_register(&port->dev); 946 retval = device_register(&port->dev);
944 if (retval) 947 if (retval)
945 dev_err(&port->dev, "Error registering port device, " 948 dev_err(&port->dev, "Error registering port device, "