Revert "tty: add the option to have a tty reject a new ldisc"

This reverts commit 3c6332f3bb 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 <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman
2024-08-17 08:32:02 +00:00
committed by Treehugger Robot
parent 7455bf543f
commit 325f5b8ed9
3 changed files with 0 additions and 24 deletions

View File

@@ -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. */

View File

@@ -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;

View File

@@ -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);