Merge branch 'android-4.4'
[firefly-linux-kernel-4.4.55.git] / drivers / tty / serial / serial_core.c
index 62fe36858a75d989ff2fa431c64a96aa850f549c..87625fac702c78268f5c41d3f686385303b8f034 100644 (file)
@@ -1895,26 +1895,6 @@ uart_parse_options(char *options, int *baud, int *parity, int *bits, int *flow)
 }
 EXPORT_SYMBOL_GPL(uart_parse_options);
 
-struct baud_rates {
-       unsigned int rate;
-       unsigned int cflag;
-};
-
-static const struct baud_rates baud_rates[] = {
-       { 921600, B921600 },
-       { 460800, B460800 },
-       { 230400, B230400 },
-       { 115200, B115200 },
-       {  57600, B57600  },
-       {  38400, B38400  },
-       {  19200, B19200  },
-       {   9600, B9600   },
-       {   4800, B4800   },
-       {   2400, B2400   },
-       {   1200, B1200   },
-       {      0, B38400  }
-};
-
 /**
  *     uart_set_options - setup the serial console parameters
  *     @port: pointer to the serial ports uart_port structure
@@ -1930,7 +1910,6 @@ uart_set_options(struct uart_port *port, struct console *co,
 {
        struct ktermios termios;
        static struct ktermios dummy;
-       int i;
 
        /*
         * Ensure that the serial console lock is initialised
@@ -1945,16 +1924,8 @@ uart_set_options(struct uart_port *port, struct console *co,
 
        memset(&termios, 0, sizeof(struct ktermios));
 
-       termios.c_cflag = CREAD | HUPCL | CLOCAL;
-
-       /*
-        * Construct a cflag setting.
-        */
-       for (i = 0; baud_rates[i].rate; i++)
-               if (baud_rates[i].rate <= baud)
-                       break;
-
-       termios.c_cflag |= baud_rates[i].cflag;
+       termios.c_cflag |= CREAD | HUPCL | CLOCAL;
+       tty_termios_encode_baud_rate(&termios, baud, baud);
 
        if (bits == 7)
                termios.c_cflag |= CS7;