]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/serial/serial_core.c
serial: fix termios settings in open
[net-next-2.6.git] / drivers / serial / serial_core.c
index a55751a12c380248e3c2a40b9d51d33e61ea3de4..3d2acc2265f72ccee322fbc2bb1a0823204fd70d 100644 (file)
@@ -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;
 }