diff options
author | Arnd Bergmann <arnd@arndb.de> | 2010-06-29 22:31:40 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 13:47:43 -0700 |
commit | 3f582b8c11014e4ce310d9839fb335164195333f (patch) | |
tree | 348ec2b19eabb25d08546c9008adab9f8e17d428 /drivers/serial | |
parent | 74c2107759dc6efaa1b9127014be58a742a1e7ac (diff) | |
download | op-kernel-dev-3f582b8c11014e4ce310d9839fb335164195333f.zip op-kernel-dev-3f582b8c11014e4ce310d9839fb335164195333f.tar.gz |
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 a55751a..3d2acc2 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) struct uart_state *state = container_of(port, struct uart_state, port); struct uart_port *uport = state->uart_port; - if (onoff) + if (onoff) { uart_set_mctrl(uport, TIOCM_DTR | TIOCM_RTS); + + /* + * If this is the first open to succeed, + * adjust things to suit. + */ + if (!test_and_set_bit(ASYNCB_NORMAL_ACTIVE, &port->flags)) + uart_update_termios(port->tty, state); + } else uart_clear_mctrl(uport, TIOCM_DTR | TIOCM_RTS); } @@ -1636,15 +1644,6 @@ static int uart_open(struct tty_struct *tty, struct file *filp) if (retval == 0) retval = tty_port_block_til_ready(port, tty, filp); - /* - * If this is the first open to succeed, adjust things to suit. - */ - if (retval == 0 && !(port->flags & ASYNC_NORMAL_ACTIVE)) { - set_bit(ASYNCB_NORMAL_ACTIVE, &port->flags); - - uart_update_termios(tty, state); - } - fail: return retval; } |