USB: pl2303: remove can't happen checks, set speed properly and report baud rate
authorAlan Cox <alan@lxorguk.ukuu.org.uk>
Mon, 15 Oct 2007 19:54:47 +0000 (20:54 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 25 Oct 2007 19:18:44 +0000 (12:18 -0700)
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/serial/pl2303.c

index 1da57fd9ea236f65db6670c682a26838da959e3e..1103b2f514b785b0bd372ee384afba63c2abadc5 100644 (file)
@@ -470,16 +470,13 @@ static void pl2303_set_termios(struct usb_serial_port *port,
 
        dbg("%s -  port %d", __FUNCTION__, port->number);
 
-       if ((!port->tty) || (!port->tty->termios)) {
-               dbg("%s - no tty structures", __FUNCTION__);
-               return;
-       }
-
        spin_lock_irqsave(&priv->lock, flags);
        if (!priv->termios_initialized) {
                *(port->tty->termios) = tty_std_termios;
                port->tty->termios->c_cflag = B9600 | CS8 | CREAD |
                                              HUPCL | CLOCAL;
+               port->tty->termios->c_ispeed = 9600;
+               port->tty->termios->c_ospeed = 9600;
                priv->termios_initialized = 1;
        }
        spin_unlock_irqrestore(&priv->lock, flags);
@@ -596,6 +593,10 @@ static void pl2303_set_termios(struct usb_serial_port *port,
                dbg ("0x40:0x1:0x0:0x0  %d", i);
        }
 
+       /* FIXME: Need to read back resulting baud rate */
+       if (baud)
+               tty_encode_baud_rate(port->tty, baud, baud);
+
        kfree(buf);
 }