Skip to content

Commit

Permalink
tty: serial: Fix termios/port flags mismatch
Browse files Browse the repository at this point in the history
Uart port drivers may reconfigure termios settings based on available
hardware support; set/clear ASYNC_CTS_FLOW and ASYNC_CHECK_CD _after_
calling the port driver's .set_termios method.

Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Jul 10, 2014
1 parent 7c6d340 commit c18b55f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/tty/serial/serial_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ static void uart_change_speed(struct tty_struct *tty, struct uart_state *state,
return;

termios = &tty->termios;
uport->ops->set_termios(uport, termios, old_termios);

/*
* Set flags based on termios cflag
Expand All @@ -463,8 +464,6 @@ static void uart_change_speed(struct tty_struct *tty, struct uart_state *state,
clear_bit(ASYNCB_CHECK_CD, &port->flags);
else
set_bit(ASYNCB_CHECK_CD, &port->flags);

uport->ops->set_termios(uport, termios, old_termios);
}

static inline int __uart_put_char(struct uart_port *port,
Expand Down Expand Up @@ -1282,6 +1281,8 @@ static void uart_set_termios(struct tty_struct *tty,
}

uart_change_speed(tty, state, old_termios);
/* reload cflag from termios; port driver may have overriden flags */
cflag = tty->termios.c_cflag;

/* Handle transition to B0 status */
if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD))
Expand Down

0 comments on commit c18b55f

Please sign in to comment.