Commit 537699ef authored by Alan Cox's avatar Alan Cox Committed by Greg Kroah-Hartman

USB: ti_usb: termios cleanups

Remove internal NULL passing in termios code
Remove all the if checks it causes
Encode the baud rate back properly
Clear CMSPAR as it is not supported
Signed-off-by: default avatarAlan Cox <alan@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 65d063ab
...@@ -581,7 +581,7 @@ static int ti_open(struct usb_serial_port *port, struct file *file) ...@@ -581,7 +581,7 @@ static int ti_open(struct usb_serial_port *port, struct file *file)
} }
} }
ti_set_termios(port, NULL); ti_set_termios(port, port->tty->termios);
dbg("%s - sending TI_OPEN_PORT", __FUNCTION__); dbg("%s - sending TI_OPEN_PORT", __FUNCTION__);
status = ti_command_out_sync(tdev, TI_OPEN_PORT, status = ti_command_out_sync(tdev, TI_OPEN_PORT,
...@@ -618,7 +618,7 @@ static int ti_open(struct usb_serial_port *port, struct file *file) ...@@ -618,7 +618,7 @@ static int ti_open(struct usb_serial_port *port, struct file *file)
usb_clear_halt(dev, port->write_urb->pipe); usb_clear_halt(dev, port->write_urb->pipe);
usb_clear_halt(dev, port->read_urb->pipe); usb_clear_halt(dev, port->read_urb->pipe);
ti_set_termios(port, NULL); ti_set_termios(port, port->tty->termios);
dbg("%s - sending TI_OPEN_PORT (2)", __FUNCTION__); dbg("%s - sending TI_OPEN_PORT (2)", __FUNCTION__);
status = ti_command_out_sync(tdev, TI_OPEN_PORT, status = ti_command_out_sync(tdev, TI_OPEN_PORT,
...@@ -897,23 +897,10 @@ static void ti_set_termios(struct usb_serial_port *port, ...@@ -897,23 +897,10 @@ static void ti_set_termios(struct usb_serial_port *port,
dbg("%s - port %d", __FUNCTION__, port->number); dbg("%s - port %d", __FUNCTION__, port->number);
if (!tty || !tty->termios) {
dbg("%s - no tty or termios", __FUNCTION__);
return;
}
cflag = tty->termios->c_cflag; cflag = tty->termios->c_cflag;
iflag = tty->termios->c_iflag; iflag = tty->termios->c_iflag;
if (old_termios && cflag == old_termios->c_cflag dbg("%s - cflag %08x, iflag %08x", __FUNCTION__, cflag, iflag);
&& iflag == old_termios->c_iflag) {
dbg("%s - nothing to change", __FUNCTION__);
return;
}
dbg("%s - clfag %08x, iflag %08x", __FUNCTION__, cflag, iflag);
if (old_termios)
dbg("%s - old clfag %08x, old iflag %08x", __FUNCTION__, old_termios->c_cflag, old_termios->c_iflag); dbg("%s - old clfag %08x, old iflag %08x", __FUNCTION__, old_termios->c_cflag, old_termios->c_iflag);
if (tport == NULL) if (tport == NULL)
...@@ -948,6 +935,9 @@ static void ti_set_termios(struct usb_serial_port *port, ...@@ -948,6 +935,9 @@ static void ti_set_termios(struct usb_serial_port *port,
break; break;
} }
/* CMSPAR isn't supported by this driver */
tty->termios->c_cflag &= ~CMSPAR;
if (cflag & PARENB) { if (cflag & PARENB) {
if (cflag & PARODD) { if (cflag & PARODD) {
config->wFlags |= TI_UART_ENABLE_PARITY_CHECKING; config->wFlags |= TI_UART_ENABLE_PARITY_CHECKING;
...@@ -990,12 +980,17 @@ static void ti_set_termios(struct usb_serial_port *port, ...@@ -990,12 +980,17 @@ static void ti_set_termios(struct usb_serial_port *port,
} }
baud = tty_get_baud_rate(tty); baud = tty_get_baud_rate(tty);
if (!baud) baud = 9600; if (!baud)
baud = 9600;
if (tport->tp_tdev->td_is_3410) if (tport->tp_tdev->td_is_3410)
config->wBaudRate = (__u16)((923077 + baud/2) / baud); config->wBaudRate = (__u16)((923077 + baud/2) / baud);
else else
config->wBaudRate = (__u16)((461538 + baud/2) / baud); config->wBaudRate = (__u16)((461538 + baud/2) / baud);
/* FIXME: Should calculate resulting baud here and report it back */
if ((cflag & CBAUD) != B0)
tty_encode_baud_rate(tty, baud, baud);
dbg("%s - BaudRate=%d, wBaudRate=%d, wFlags=0x%04X, bDataBits=%d, bParity=%d, bStopBits=%d, cXon=%d, cXoff=%d, bUartMode=%d", dbg("%s - BaudRate=%d, wBaudRate=%d, wFlags=0x%04X, bDataBits=%d, bParity=%d, bStopBits=%d, cXon=%d, cXoff=%d, bUartMode=%d",
__FUNCTION__, baud, config->wBaudRate, config->wFlags, config->bDataBits, config->bParity, config->bStopBits, config->cXon, config->cXoff, config->bUartMode); __FUNCTION__, baud, config->wBaudRate, config->wFlags, config->bDataBits, config->bParity, config->bStopBits, config->cXon, config->cXoff, config->bUartMode);
......
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