diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-06-29 16:31:40 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 16:47:43 -0400 |
commit | 3f582b8c11014e4ce310d9839fb335164195333f (patch) | |
tree | 348ec2b19eabb25d08546c9008adab9f8e17d428 /drivers/serial | |
parent | 74c2107759dc6efaa1b9127014be58a742a1e7ac (diff) |
serial: fix termios settings in open
Move termios initialization in open into uart_dtr_rts to make sure
it always gets called when necessary. Based on a suggestion from
Alan Cox.
Alan writes:
Ok this sort of makes sense. Something isn't getting initialised and both
getty and minicom will do a termios set which is sorting it out.
This is occurring because the generic block_til_ready sets
ASYNCB_NORMAL_ACTIVE so the termios updating gets skipped.
This patch should cure it and then we can think about doing it more
elegantly by getting the serial layer to use tty_port_open, kfifo and
the like and removing the tons of repeated crap in all the drivers.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reported-by: Tony Luck <tony.luck@intel.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/serial_core.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/serial/serial_core.c b/drivers/serial/serial_core.c index a55751a12c38..3d2acc2265f7 100644 --- a/drivers/serial/serial_core.c +++ b/drivers/serial/serial_core.c | |||
@@ -1520,8 +1520,16 @@ static void uart_dtr_rts(struct tty_port *port, int onoff) | |||
1520 | struct uart_state *state = container_of(port, struct uart_state, port); | 1520 | struct uart_state *state = container_of(port, struct uart_state, port); |
1521 | struct uart_port *uport = state->uart_port; | 1521 | struct uart_port *uport = state->uart_port; |
1522 | 1522 | ||
1523 | if (onoff) | 1523 | if (onoff) { |
1524 | uart_set_mctrl(uport, TIOCM_DTR | TIOCM_RTS); | 1524 | uart_set_mctrl(uport, TIOCM_DTR | TIOCM_RTS); |
1525 | |||
1526 | /* | ||
1527 | * If this is the first open to succeed, | ||
1528 | * adjust things to suit. | ||
1529 | */ | ||
1530 | if (!test_and_set_bit(ASYNCB_NORMAL_ACTIVE, &port->flags)) | ||
1531 | uart_update_termios(port->tty, state); | ||
1532 | } | ||
1525 | else | 1533 | else |
1526 | uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS); | 1534 | uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS); |
1527 | } | 1535 | } |
@@ -1636,15 +1644,6 @@ static int uart_open(struct tty_struct *tty, struct file *filp) | |||
1636 | if (retval == 0) | 1644 | if (retval == 0) |
1637 | retval = tty_port_block_til_ready(port, tty, filp); | 1645 | retval = tty_port_block_til_ready(port, tty, filp); |
1638 | 1646 | ||
1639 | /* | ||
1640 | * If this is the first open to succeed, adjust things to suit. | ||
1641 | */ | ||
1642 | if (retval == 0 && !(port->flags & ASYNC_NORMAL_ACTIVE)) { | ||
1643 | set_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); | ||
1644 | |||
1645 | uart_update_termios(tty, state); | ||
1646 | } | ||
1647 | |||
1648 | fail: | 1647 | fail: |
1649 | return retval; | 1648 | return retval; |
1650 | } | 1649 | } |