From 325f5b8ed9b8cf162f8a6234de935f89bf3b7418 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 17 Aug 2024 08:32:02 +0000 Subject: [PATCH] Revert "tty: add the option to have a tty reject a new ldisc" This reverts commit 3c6332f3bb1578b5b10ac2561247b1d6272ae937 which is commit 6bd23e0c2bb6c65d4f5754d1456bc9a4427fc59b upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: Ia8d68d62f97da2536404bfb439f2db596033260f Signed-off-by: Greg Kroah-Hartman --- drivers/tty/tty_ldisc.c | 6 ------ drivers/tty/vt/vt.c | 10 ---------- include/linux/tty_driver.h | 8 -------- 3 files changed, 24 deletions(-) diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 7ca7731fa78a..776d8a62f77c 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c @@ -546,12 +546,6 @@ int tty_set_ldisc(struct tty_struct *tty, int disc) goto out; } - if (tty->ops->ldisc_ok) { - retval = tty->ops->ldisc_ok(tty, disc); - if (retval) - goto out; - } - old_ldisc = tty->ldisc; /* Shutdown the old discipline. */ diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c index e2f9348725ff..48a9ed7c93c9 100644 --- a/drivers/tty/vt/vt.c +++ b/drivers/tty/vt/vt.c @@ -3440,15 +3440,6 @@ static void con_cleanup(struct tty_struct *tty) tty_port_put(&vc->port); } -/* - * We can't deal with anything but the N_TTY ldisc, - * because we can sleep in our write() routine. - */ -static int con_ldisc_ok(struct tty_struct *tty, int ldisc) -{ - return ldisc == N_TTY ? 0 : -EINVAL; -} - static int default_color = 7; /* white */ static int default_italic_color = 2; // green (ASCII) static int default_underline_color = 3; // cyan (ASCII) @@ -3575,7 +3566,6 @@ static const struct tty_operations con_ops = { .resize = vt_resize, .shutdown = con_shutdown, .cleanup = con_cleanup, - .ldisc_ok = con_ldisc_ok, }; static struct cdev vc0_cdev; diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h index 331b1884ac23..cf6a8bacebc1 100644 --- a/include/linux/tty_driver.h +++ b/include/linux/tty_driver.h @@ -156,13 +156,6 @@ struct serial_struct; * * Optional. Called under the @tty->termios_rwsem. May sleep. * - * @ldisc_ok: ``int ()(struct tty_struct *tty, int ldisc)`` - * - * This routine allows the @tty driver to decide if it can deal - * with a particular @ldisc. - * - * Optional. Called under the @tty->ldisc_sem and @tty->termios_rwsem. - * * @set_ldisc: ``void ()(struct tty_struct *tty)`` * * This routine allows the @tty driver to be notified when the device's @@ -382,7 +375,6 @@ struct tty_operations { void (*hangup)(struct tty_struct *tty); int (*break_ctl)(struct tty_struct *tty, int state); void (*flush_buffer)(struct tty_struct *tty); - int (*ldisc_ok)(struct tty_struct *tty, int ldisc); void (*set_ldisc)(struct tty_struct *tty); void (*wait_until_sent)(struct tty_struct *tty, int timeout); void (*send_xchar)(struct tty_struct *tty, char ch);