USB: kl5kusb105: always disable uart on close
authorJohan Hovold <jhovold@gmail.com>
Thu, 21 Mar 2013 11:37:39 +0000 (12:37 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 25 Mar 2013 20:54:31 +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/kl5kusb105.c

index 57fd001..1b4054f 100644 (file)
@@ -341,22 +341,17 @@ static void klsi_105_close(struct usb_serial_port *port)
 {
        int rc;
 
-       mutex_lock(&port->serial->disc_mutex);
-       if (!port->serial->disconnected) {
-               /* send READ_OFF */
-               rc = usb_control_msg(port->serial->dev,
-                                    usb_sndctrlpipe(port->serial->dev, 0),
-                                    KL5KUSB105A_SIO_CONFIGURE,
-                                    USB_TYPE_VENDOR | USB_DIR_OUT,
-                                    KL5KUSB105A_SIO_CONFIGURE_READ_OFF,
-                                    0, /* index */
-                                    NULL, 0,
-                                    KLSI_TIMEOUT);
-               if (rc < 0)
-                       dev_err(&port->dev,
-                               "Disabling read failed (error = %d)\n", rc);
-       }
-       mutex_unlock(&port->serial->disc_mutex);
+       /* send READ_OFF */
+       rc = usb_control_msg(port->serial->dev,
+                            usb_sndctrlpipe(port->serial->dev, 0),
+                            KL5KUSB105A_SIO_CONFIGURE,
+                            USB_TYPE_VENDOR | USB_DIR_OUT,
+                            KL5KUSB105A_SIO_CONFIGURE_READ_OFF,
+                            0, /* index */
+                            NULL, 0,
+                            KLSI_TIMEOUT);
+       if (rc < 0)
+               dev_err(&port->dev, "failed to disable read: %d\n", rc);
 
        /* shutdown our bulk reads and writes */
        usb_serial_generic_close(port);