Skip to content

Commit

Permalink
serial: core: cleanup in uart_get_baud_rate()
Browse files Browse the repository at this point in the history
Align with coding guidelines:
Replaced a chain of "else if" by a switch case.

Signed-off-by: Joakim Nordell <joakim.nordell@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Joakim Nordell authored and Greg Kroah-Hartman committed Jun 13, 2015
1 parent 48a6092 commit f10a223
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions drivers/tty/serial/serial_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -335,18 +335,29 @@ unsigned int
uart_get_baud_rate(struct uart_port *port, struct ktermios *termios,
struct ktermios *old, unsigned int min, unsigned int max)
{
unsigned int try, baud, altbaud = 38400;
unsigned int try;
unsigned int baud;
unsigned int altbaud;
int hung_up = 0;
upf_t flags = port->flags & UPF_SPD_MASK;

if (flags == UPF_SPD_HI)
switch (flags) {
case UPF_SPD_HI:
altbaud = 57600;
else if (flags == UPF_SPD_VHI)
break;
case UPF_SPD_VHI:
altbaud = 115200;
else if (flags == UPF_SPD_SHI)
break;
case UPF_SPD_SHI:
altbaud = 230400;
else if (flags == UPF_SPD_WARP)
break;
case UPF_SPD_WARP:
altbaud = 460800;
break;
default:
altbaud = 38400;
break;
}

for (try = 0; try < 2; try++) {
baud = tty_termios_baud_rate(termios);
Expand Down

0 comments on commit f10a223

Please sign in to comment.