bool tty_buffer_restart_work(struct tty_port *port);
 bool tty_buffer_cancel_work(struct tty_port *port);
 void tty_buffer_flush_work(struct tty_port *port);
-speed_t tty_termios_input_baud_rate(struct ktermios *termios);
+speed_t tty_termios_input_baud_rate(const struct ktermios *termios);
 void tty_ldisc_hangup(struct tty_struct *tty, bool reset);
 int tty_ldisc_reinit(struct tty_struct *tty, int disc);
 long tty_ioctl(struct file *file, unsigned int cmd, unsigned long arg);
 
  *
  *     Convert termios baud rate data into a speed. This should be called
  *     with the termios lock held if this termios is a terminal termios
- *     structure. May change the termios data. Device drivers can call this
- *     function but should use ->c_[io]speed directly as they are updated.
+ *     structure. Device drivers can call this function but should use
+ *     ->c_[io]speed directly as they are updated.
  *
  *     Locking: none
  */
 
-speed_t tty_termios_baud_rate(struct ktermios *termios)
+speed_t tty_termios_baud_rate(const struct ktermios *termios)
 {
        unsigned int cbaud;
 
 
        if (cbaud & CBAUDEX) {
                cbaud &= ~CBAUDEX;
-
-               if (cbaud < 1 || cbaud + 15 > n_baud_table)
-                       termios->c_cflag &= ~CBAUDEX;
-               else
-                       cbaud += 15;
+               cbaud += 15;
        }
        return cbaud >= n_baud_table ? 0 : baud_table[cbaud];
 }
  *
  *     Convert termios baud rate data into a speed. This should be called
  *     with the termios lock held if this termios is a terminal termios
- *     structure. May change the termios data. Device drivers can call this
- *     function but should use ->c_[io]speed directly as they are updated.
+ *     structure. Device drivers can call this function but should use
+ *     ->c_[io]speed directly as they are updated.
  *
  *     Locking: none
  */
 
-speed_t tty_termios_input_baud_rate(struct ktermios *termios)
+speed_t tty_termios_input_baud_rate(const struct ktermios *termios)
 {
        unsigned int cbaud = (termios->c_cflag >> IBSHIFT) & CBAUD;
 
 
        if (cbaud & CBAUDEX) {
                cbaud &= ~CBAUDEX;
-
-               if (cbaud < 1 || cbaud + 15 > n_baud_table)
-                       termios->c_cflag &= ~(CBAUDEX << IBSHIFT);
-               else
-                       cbaud += 15;
+               cbaud += 15;
        }
        return cbaud >= n_baud_table ? 0 : baud_table[cbaud];
 }
 
 void do_SAK(struct tty_struct *tty);
 void __do_SAK(struct tty_struct *tty);
 void no_tty(void);
-speed_t tty_termios_baud_rate(struct ktermios *termios);
+speed_t tty_termios_baud_rate(const struct ktermios *termios);
 void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud,
                speed_t obaud);
 void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud,