Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3edbc986509888fa9977cc180c1fe458d2f89076
Commit:     3edbc986509888fa9977cc180c1fe458d2f89076
Parent:     b0a239da17beb34354181bebb744c0b0d534967f
Author:     Oliver Neukum <[EMAIL PROTECTED]>
AuthorDate: Tue Jan 22 12:47:15 2008 +0100
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Fri Feb 1 14:35:05 2008 -0800

    USB: kl5kusb105 don't flush to logically disconnected devices
    
    If disconnect() is called for a logical disconnect, no more IO must be
    done after disconnect() returns, or the old and new drivers may conflict.
    This patch avoids this by using the flag and lock introduced by the earlier
    patch for the mos7720 driver.
    
    Signed-off-by: Oliver Neukum <[EMAIL PROTECTED]>
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/serial/kl5kusb105.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/usb/serial/kl5kusb105.c b/drivers/usb/serial/kl5kusb105.c
index 90e3216..55736df 100644
--- a/drivers/usb/serial/kl5kusb105.c
+++ b/drivers/usb/serial/kl5kusb105.c
@@ -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);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to