tty: serial: msm_serial: code cleanup in msm_console_setup
authorPramod Gurav <pramod.gurav@smartplayin.com>
Mon, 12 Jan 2015 13:45:32 +0000 (19:15 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 2 Feb 2015 18:11:25 +0000 (10:11 -0800)
The change does following:
 - baud, flow, bits, parity were being overwritten as they were
   being reinitialized after parsing.  Initialize them when they are
   declared so that user provided setting are not overwritten.
 - msm_set_baud_rate() is anyway called in uart_set_options when it calls
   msm_set_termios(). msm_reset() is called when we change the baud rate.
   Hence doing away with both of these calls.
 - CR_CMD_PROTECTION_EN and CR_TX_ENABLE settings are done in msm_set_baud_rate.
   So do away with this here.

Signed-off-by: Pramod Gurav <pramod.gurav@smartplayin.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/msm_serial.c

index c88b522ccd73470967a5fbd03480ce7b4e3b6d62..a0cc6e08552fa985471464a80e6ca10ee10d3736 100644 (file)
@@ -920,14 +920,15 @@ static void msm_console_write(struct console *co, const char *s,
 static int __init msm_console_setup(struct console *co, char *options)
 {
        struct uart_port *port;
-       struct msm_port *msm_port;
-       int baud = 0, flow, bits, parity;
+       int baud = 115200;
+       int bits = 8;
+       int parity = 'n';
+       int flow = 'n';
 
        if (unlikely(co->index >= UART_NR || co->index < 0))
                return -ENXIO;
 
        port = get_port_from_line(co->index);
-       msm_port = UART_TO_MSM(port);
 
        if (unlikely(!port->membase))
                return -ENXIO;
@@ -937,23 +938,6 @@ static int __init msm_console_setup(struct console *co, char *options)
        if (options)
                uart_parse_options(options, &baud, &parity, &bits, &flow);
 
-       bits = 8;
-       parity = 'n';
-       flow = 'n';
-       msm_write(port, UART_MR2_BITS_PER_CHAR_8 | UART_MR2_STOP_BIT_LEN_ONE,
-                 UART_MR2);    /* 8N1 */
-
-       if (baud < 300 || baud > 115200)
-               baud = 115200;
-       msm_set_baud_rate(port, baud);
-
-       msm_reset(port);
-
-       if (msm_port->is_uartdm) {
-               msm_write(port, UART_CR_CMD_PROTECTION_EN, UART_CR);
-               msm_write(port, UART_CR_TX_ENABLE, UART_CR);
-       }
-
        pr_info("msm_serial: console setup on port #%d\n", port->line);
 
        return uart_set_options(port, co, baud, parity, bits, flow);