serial: cascade needless conditionals
authorAndré Goddard Rosa <andre.goddard@gmail.com>
Sun, 25 Oct 2009 13:18:26 +0000 (11:18 -0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 11 Dec 2009 23:18:04 +0000 (15:18 -0800)
Signed-off-by: André Goddard Rosa <andre.goddard@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/serial/serial_core.c

index 885eabe552cda03d958fdc388fc92cb5335229d3..047530b285bb3a50ddf15d8804080980d9539978 100644 (file)
@@ -342,11 +342,11 @@ uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
 
        if (flags == UPF_SPD_HI)
                altbaud = 57600;
-       if (flags == UPF_SPD_VHI)
+       else if (flags == UPF_SPD_VHI)
                altbaud = 115200;
-       if (flags == UPF_SPD_SHI)
+       else if (flags == UPF_SPD_SHI)
                altbaud = 230400;
-       if (flags == UPF_SPD_WARP)
+       else if (flags == UPF_SPD_WARP)
                altbaud = 460800;
 
        for (try = 0; try < 2; try++) {
@@ -1217,9 +1217,8 @@ static void uart_set_termios(struct tty_struct *tty,
        /* Handle transition to B0 status */
        if ((old_termios->c_cflag & CBAUD) && !(cflag & CBAUD))
                uart_clear_mctrl(state->uart_port, TIOCM_RTS | TIOCM_DTR);
-
        /* Handle transition away from B0 status */
-       if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) {
+       else if (!(old_termios->c_cflag & CBAUD) && (cflag & CBAUD)) {
                unsigned int mask = TIOCM_DTR;
                if (!(cflag & CRTSCTS) ||
                    !test_bit(TTY_THROTTLED, &tty->flags))
@@ -1234,9 +1233,8 @@ static void uart_set_termios(struct tty_struct *tty,
                __uart_start(tty);
                spin_unlock_irqrestore(&state->uart_port->lock, flags);
        }
-
        /* Handle turning on CRTSCTS */
-       if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) {
+       else if (!(old_termios->c_cflag & CRTSCTS) && (cflag & CRTSCTS)) {
                spin_lock_irqsave(&state->uart_port->lock, flags);
                if (!(state->uart_port->ops->get_mctrl(state->uart_port) & TIOCM_CTS)) {
                        tty->hw_stopped = 1;