summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Hovold <jhovold@gmail.com>2013-03-21 15:36:50 +0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-03-26 00:48:27 +0400
commit5cb27dde2e8b7bcbdce6de270c73c021a65caff8 (patch)
tree31822932c11b0b4d3d034a92c5fc4320d367af0b
parent6a5c821cad1459ec2b5fd5778f46d13c4255a7bf (diff)
downloadlinux-5cb27dde2e8b7bcbdce6de270c73c021a65caff8.tar.xz
USB: serial: clean up usb-serial bus device removal
Make sure to unregister the tty-device before calling subdriver port_remove. This way remove will reverse probe, and specifically any port data released in port_remove will be available throughout tty unregister. Note that the order currently does not matter as the tty-layer can make callbacks also after the device has been unregistered. This is handled in usb-serial core using the disconnected flag, which is already set when usb-serial bus device remove is called. Cc: Peter Hurley <peter@hurleysoftware.com> Reported-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/serial/bus.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index 37decb13d7eb..3c4db6d196c6 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -106,14 +106,15 @@ static int usb_serial_device_remove(struct device *dev)
/* make sure suspend/resume doesn't race against port_remove */
usb_autopm_get_interface(port->serial->interface);
+ minor = port->number;
+ tty_unregister_device(usb_serial_tty_driver, minor);
+
device_remove_file(&port->dev, &dev_attr_port_number);
driver = port->serial->type;
if (driver->port_remove)
retval = driver->port_remove(port);
- minor = port->number;
- tty_unregister_device(usb_serial_tty_driver, minor);
dev_info(dev, "%s converter now disconnected from ttyUSB%d\n",
driver->description, minor);