]> git.hungrycats.org Git - linux/commitdiff
[PATCH] USB: fix up B0 support in the pl2303 driver.
authorGreg Kroah-Hartman <greg@kroah.com>
Wed, 3 Sep 2003 04:44:49 +0000 (21:44 -0700)
committerGreg Kroah-Hartman <greg@kroah.com>
Wed, 3 Sep 2003 04:44:49 +0000 (21:44 -0700)
Thanks to Gernot Fink <gernot.fink@netsurf.de> for pointing this out.

drivers/usb/serial/pl2303.c

index aa5f3129dc094ed1dee4fb5bb8c762163af76cea..f2b00375cfdbd70e686fdbd3363973092789a20d 100644 (file)
@@ -245,6 +245,7 @@ static void pl2303_set_termios (struct usb_serial_port *port, struct termios *ol
        unsigned char *buf;
        int baud;
        int i;
+       u8 control;
 
        dbg("%s -  port %d", __FUNCTION__, port->number);
 
@@ -360,17 +361,19 @@ static void pl2303_set_termios (struct usb_serial_port *port, struct termios *ol
                             0, 0, buf, 7, 100);
        dbg ("0x21:0x20:0:0  %d", i);
 
-       if (cflag && CBAUD) {
-               u8 control;
-
-               spin_lock_irqsave(&priv->lock, flags);
-               if ((cflag && CBAUD) == B0)
-                       priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS);
-               else
-                       priv->line_control |= (CONTROL_DTR | CONTROL_RTS);
+       /* change control lines if we are switching to or from B0 */
+       spin_lock_irqsave(&priv->lock, flags);
+       control = priv->line_control;
+       if ((cflag & CBAUD) == B0)
+               priv->line_control &= ~(CONTROL_DTR | CONTROL_RTS);
+       else
+               priv->line_control |= (CONTROL_DTR | CONTROL_RTS);
+       if (control != priv->line_control) {
                control = priv->line_control;
                spin_unlock_irqrestore(&priv->lock, flags);
-               set_control_lines (serial->dev, control);
+               set_control_lines(serial->dev, control);
+       } else {
+               spin_unlock_irqrestore(&priv->lock, flags);
        }
        
        buf[0] = buf[1] = buf[2] = buf[3] = buf[4] = buf[5] = buf[6] = 0;