summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJoakim Nordell <joakim.nordell@intel.com>2015-06-08 15:56:51 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-06-13 03:34:36 +0300
commitf10a2233210aeaf8695039f3fc45aa2e064f1882 (patch)
tree89e742051684078cbbac98678adf4b965a495331 /drivers
parent48a6092fb41fab5b80064c3fac786f8ec86457a3 (diff)
downloadlinux-f10a2233210aeaf8695039f3fc45aa2e064f1882.tar.xz
serial: core: cleanup in uart_get_baud_rate()
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/serial_core.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 860e59fd6ef4..7ae1592f7ec9 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -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);