Commit fbadf70a authored by Jiri Slaby's avatar Jiri Slaby Committed by Greg Kroah-Hartman
Browse files

tty: set tty_ldisc_ops::num statically



There is no reason to pass the ldisc number to tty_register_ldisc
separately. Just set it in the already defined tty_ldisc_ops in all the
ldiscs.

This simplifies tty_register_ldisc a bit too (no need to set the num
member there).

Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Cc: William Hubbs <w.d.hubbs@gmail.com>
Cc: Chris Brannon <chris@the-brannons.com>
Cc: Kirk Reiser <kirk@reisers.ca>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>
Cc: Marc Kleine-Budde <mkl@pengutronix.de>
Cc: Andreas Koensgen <ajk@comnets.uni-bremen.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Rodolfo Giometti <giometti@enneenne.com>
Cc: Peter Ujfalusi <peter.ujfalusi@gmail.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Link: https://lore.kernel.org/r/20210505091928.22010-15-jslaby@suse.cz


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 64d608db
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -105,6 +105,7 @@ static int spk_ttyio_receive_buf2(struct tty_struct *tty,

static struct tty_ldisc_ops spk_ttyio_ldisc_ops = {
	.owner          = THIS_MODULE,
	.num		= N_SPEAKUP,
	.name           = "speakup_ldisc",
	.open           = spk_ttyio_ldisc_open,
	.close          = spk_ttyio_ldisc_close,
@@ -212,7 +213,7 @@ static int spk_ttyio_initialise_ldisc(struct spk_synth *synth)

void spk_ttyio_register_ldisc(void)
{
	if (tty_register_ldisc(N_SPEAKUP, &spk_ttyio_ldisc_ops))
	if (tty_register_ldisc(&spk_ttyio_ldisc_ops))
		pr_warn("speakup: Error registering line discipline. Most synths won't work.\n");
}

+2 −1
Original line number Diff line number Diff line
@@ -821,6 +821,7 @@ static __poll_t hci_uart_tty_poll(struct tty_struct *tty,

static struct tty_ldisc_ops hci_uart_ldisc = {
	.owner		= THIS_MODULE,
	.num		= N_HCI,
	.name		= "n_hci",
	.open		= hci_uart_tty_open,
	.close		= hci_uart_tty_close,
@@ -840,7 +841,7 @@ static int __init hci_uart_init(void)
	BT_INFO("HCI UART driver ver %s", VERSION);

	/* Register the tty discipline */
	err = tty_register_ldisc(N_HCI, &hci_uart_ldisc);
	err = tty_register_ldisc(&hci_uart_ldisc);
	if (err) {
		BT_ERR("HCI line discipline registration failed. (%d)", err);
		return err;
+2 −1
Original line number Diff line number Diff line
@@ -274,6 +274,7 @@ static void serport_ldisc_write_wakeup(struct tty_struct * tty)

static struct tty_ldisc_ops serport_ldisc = {
	.owner =	THIS_MODULE,
	.num =		N_MOUSE,
	.name =		"input",
	.open =		serport_ldisc_open,
	.close =	serport_ldisc_close,
@@ -294,7 +295,7 @@ static struct tty_ldisc_ops serport_ldisc = {
static int __init serport_init(void)
{
	int retval;
	retval = tty_register_ldisc(N_MOUSE, &serport_ldisc);
	retval = tty_register_ldisc(&serport_ldisc);
	if (retval)
		printk(KERN_ERR "serport.c: Error registering line discipline.\n");

+2 −1
Original line number Diff line number Diff line
@@ -845,6 +845,7 @@ static void st_tty_flush_buffer(struct tty_struct *tty)
}

static struct tty_ldisc_ops st_ldisc_ops = {
	.num = N_TI_WL,
	.name = "n_st",
	.open = st_tty_open,
	.close = st_tty_close,
@@ -860,7 +861,7 @@ int st_core_init(struct st_data_s **core_data)
	struct st_data_s *st_gdata;
	long err;

	err = tty_register_ldisc(N_TI_WL, &st_ldisc_ops);
	err = tty_register_ldisc(&st_ldisc_ops);
	if (err) {
		pr_err("error registering %d line discipline %ld",
			   N_TI_WL, err);
+2 −1
Original line number Diff line number Diff line
@@ -382,6 +382,7 @@ static void ldisc_close(struct tty_struct *tty)
/* The line discipline structure. */
static struct tty_ldisc_ops caif_ldisc = {
	.owner =	THIS_MODULE,
	.num =		N_CAIF,
	.name =		"n_caif",
	.open =		ldisc_open,
	.close =	ldisc_close,
@@ -431,7 +432,7 @@ static int __init caif_ser_init(void)
{
	int ret;

	ret = tty_register_ldisc(N_CAIF, &caif_ldisc);
	ret = tty_register_ldisc(&caif_ldisc);
	if (ret < 0)
		pr_err("cannot register CAIF ldisc=%d err=%d\n", N_CAIF, ret);

Loading