]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/usb/serial/kl5kusb105.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/teigland/dlm
[linux-2.6-omap-h63xx.git] / drivers / usb / serial / kl5kusb105.c
index 90e3216abd1f006800f0d2ed018a83c12a9b5cc0..55736df7d2f4ed0232d2c33700d353a47336cafe 100644 (file)
@@ -461,17 +461,21 @@ static void klsi_105_close (struct usb_serial_port *port, struct file *filp)
 
        dbg("%s port %d", __FUNCTION__, port->number);
 
-       /* 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)
-                   err("Disabling read failed (error = %d)", 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)
+                       err("Disabling read failed (error = %d)", rc);
+       }
+       mutex_unlock(&port->serial->disc_mutex);
 
        /* shutdown our bulk reads and writes */
        usb_kill_urb(port->write_urb);