tty: Make ldisc ->set_termios() old ktermios const
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 16 Aug 2022 11:57:36 +0000 (14:57 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Aug 2022 12:22:34 +0000 (14:22 +0200)
There should be no reason to adjust old ktermios which is going to get
discarded anyway.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220816115739.10928-6-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/n_tty.c
include/linux/tty_ldisc.h

index 3afdd9033a9c50b82b9f6e5c33471c7d908afed9..597019690ae62b088faffdae4d2e7be0165dcae0 100644 (file)
@@ -1758,7 +1758,7 @@ static int n_tty_receive_buf2(struct tty_struct *tty, const unsigned char *cp,
  *
  * Locking: Caller holds @tty->termios_rwsem
  */
-static void n_tty_set_termios(struct tty_struct *tty, struct ktermios *old)
+static void n_tty_set_termios(struct tty_struct *tty, const struct ktermios *old)
 {
        struct n_tty_data *ldata = tty->disc_data;
 
index ede6f2157f329fe8dc4b0abd01b972238c117bbe..dcb61ec11424ad46e02188b57720a22ac7b72889 100644 (file)
@@ -130,7 +130,7 @@ int ldsem_down_write_nested(struct ld_semaphore *sem, int subclass,
  *     a pointer to wordsize-sensitive structure belongs here, but most of
  *     ldiscs will happily leave it %NULL.
  *
- * @set_termios: [TTY] ``void ()(struct tty_struct *tty, struct ktermios *old)``
+ * @set_termios: [TTY] ``void ()(struct tty_struct *tty, const struct ktermios *old)``
  *
  *     This function notifies the line discpline that a change has been made
  *     to the termios structure.
@@ -227,7 +227,7 @@ struct tty_ldisc_ops {
                        unsigned long arg);
        int     (*compat_ioctl)(struct tty_struct *tty, unsigned int cmd,
                        unsigned long arg);
-       void    (*set_termios)(struct tty_struct *tty, struct ktermios *old);
+       void    (*set_termios)(struct tty_struct *tty, const struct ktermios *old);
        __poll_t (*poll)(struct tty_struct *tty, struct file *file,
                             struct poll_table_struct *wait);
        void    (*hangup)(struct tty_struct *tty);