Commit 01e96d28 authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

cp2101: Remove broken termios optimisation, use proper speed API

I've also enabled the commented out support for 7200, 14400, 55854,
127117 and 3686400 baud as you can now set such rates in the kernel.
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 67f5dde3
...@@ -356,7 +356,7 @@ static void cp2101_get_termios (struct usb_serial_port *port) ...@@ -356,7 +356,7 @@ static void cp2101_get_termios (struct usb_serial_port *port)
dbg("%s - port %d", __FUNCTION__, port->number); dbg("%s - port %d", __FUNCTION__, port->number);
if ((!port->tty) || (!port->tty->termios)) { if (!port->tty || !port->tty->termios) {
dbg("%s - no tty structures", __FUNCTION__); dbg("%s - no tty structures", __FUNCTION__);
return; return;
} }
...@@ -526,50 +526,35 @@ static void cp2101_set_termios (struct usb_serial_port *port, ...@@ -526,50 +526,35 @@ static void cp2101_set_termios (struct usb_serial_port *port,
return; return;
} }
cflag = port->tty->termios->c_cflag; cflag = port->tty->termios->c_cflag;
/* Check that they really want us to change something */
if (old_termios) {
if ((cflag == old_termios->c_cflag) &&
(RELEVANT_IFLAG(port->tty->termios->c_iflag)
== RELEVANT_IFLAG(old_termios->c_iflag))) {
dbg("%s - nothing to change...", __FUNCTION__);
return;
}
old_cflag = old_termios->c_cflag; old_cflag = old_termios->c_cflag;
} baud = tty_get_baud_rate(port->tty);
/* If the baud rate is to be updated*/ /* If the baud rate is to be updated*/
if ((cflag & CBAUD) != (old_cflag & CBAUD)) { if (baud != tty_termios_baud_rate(old_termios)) {
switch (cflag & CBAUD) { switch (baud) {
/* case 0:
* The baud rates which are commented out below case 600:
* appear to be supported by the device case 1200:
* but are non-standard case 1800:
*/ case 2400:
case B0: baud = 0; break; case 4800:
case B600: baud = 600; break; case 7200:
case B1200: baud = 1200; break; case 9600:
case B1800: baud = 1800; break; case 14400:
case B2400: baud = 2400; break; case 19200:
case B4800: baud = 4800; break; case 28800:
/*case B7200: baud = 7200; break;*/ case 38400:
case B9600: baud = 9600; break; case 55854:
/*ase B14400: baud = 14400; break;*/ case 57600:
case B19200: baud = 19200; break; case 115200:
/*case B28800: baud = 28800; break;*/ case 127117:
case B38400: baud = 38400; break; case 230400:
/*case B55854: baud = 55054; break;*/ case 460800:
case B57600: baud = 57600; break; case 921600:
case B115200: baud = 115200; break; case 3686400:
/*case B127117: baud = 127117; break;*/ break;
case B230400: baud = 230400; break;
case B460800: baud = 460800; break;
case B921600: baud = 921600; break;
/*case B3686400: baud = 3686400; break;*/
default: default:
dev_err(&port->dev, "cp2101 driver does not " baud = 9600;
"support the baudrate requested\n");
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment