USB: quatech2: always disable uart on close
authorJohan Hovold <jhovold@gmail.com>
Thu, 21 Mar 2013 11:37:46 +0000 (12:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Mar 2013 20:54:32 +0000 (13:54 -0700)
Always try to disable the uart on close.

Since the switch to tty ports, close will be called as part of shutdown
before disconnect returns. Hence there is no need to check the
disconnected flag, and we can put devices in disabled states also on
driver unbind.

Signed-off-by: Johan Hovold <jhovold@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/serial/quatech2.c

index 085cad471c4126d016e72178ec70b6ed103b12a0..3c278521f7e2179a7886537c7118da6e32490d2b 100644 (file)
@@ -422,12 +422,6 @@ static void qt2_close(struct usb_serial_port *port)
        port_priv->urb_in_use = false;
        spin_unlock_irqrestore(&port_priv->urb_lock, flags);
 
-       mutex_lock(&port->serial->disc_mutex);
-       if (port->serial->disconnected) {
-               mutex_unlock(&port->serial->disc_mutex);
-               return;
-       }
-
        /* flush the port transmit buffer */
        i = usb_control_msg(serial->dev,
                            usb_rcvctrlpipe(serial->dev, 0),
@@ -458,8 +452,6 @@ static void qt2_close(struct usb_serial_port *port)
        if (i < 0)
                dev_err(&port->dev, "%s - close port failed %i\n",
                        __func__, i);
-
-       mutex_unlock(&port->serial->disc_mutex);
 }
 
 static void qt2_disconnect(struct usb_serial *serial)