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

tty: stop using alloc_tty_driver



alloc_tty_driver was deprecated by tty_alloc_driver in commit
7f0bc6a6 (TTY: pass flags to alloc_tty_driver) in 2012.

I never got into eliminating alloc_tty_driver until now. So we still
have two functions for allocating drivers which might be confusing. So
get rid of alloc_tty_driver uses to eliminate it for good in the next
patch.

Note we need to switch return value checking as tty_alloc_driver uses
ERR_PTR. And flags are now a parameter of tty_alloc_driver.

Cc: Richard Henderson <rth@twiddle.net>(odd fixer:ALPHA PORT)
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
Cc: Helge Deller <deller@gmx.de>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Richard Weinberger <richard@nod.at>
Cc: Anton Ivanov <anton.ivanov@cambridgegreys.com>
Cc: Chris Zankel <chris@zankel.net>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
Cc: Jens Taprogge <jens.taprogge@taprogge.org>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: David Sterba <dsterba@suse.com>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Oliver Neukum <oneukum@suse.com>
Cc: Felipe Balbi <balbi@kernel.org>
Cc: Johan Hovold <johan@kernel.org>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Acked-by: default avatarSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Acked-by: default avatarMax Filippov <jcmvbkbc@gmail.com>
Acked-by: default avatarDavid Sterba <dsterba@suse.com>
Acked-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20210723074317.32690-5-jslaby@suse.cz


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0524513a
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -204,9 +204,9 @@ srmcons_init(void)
		struct tty_driver *driver;
		int err;

		driver = alloc_tty_driver(MAX_SRM_CONSOLE_DEVICES);
		if (!driver)
			return -ENOMEM;
		driver = tty_alloc_driver(MAX_SRM_CONSOLE_DEVICES, 0);
		if (IS_ERR(driver))
			return PTR_ERR(driver);

		tty_port_init(&srmcons_singleton.port);

+3 −4
Original line number Diff line number Diff line
@@ -127,9 +127,9 @@ static int __init nfcon_init(void)
	if (!stderr_id)
		return -ENODEV;

	driver = alloc_tty_driver(1);
	if (!driver)
		return -ENOMEM;
	driver = tty_alloc_driver(1, TTY_DRIVER_REAL_RAW);
	if (IS_ERR(driver))
		return PTR_ERR(driver);

	tty_port_init(&nfcon_tty_port);

@@ -138,7 +138,6 @@ static int __init nfcon_init(void)
	driver->type = TTY_DRIVER_TYPE_SYSTEM;
	driver->subtype = SYSTEM_TYPE_TTY;
	driver->init_termios = tty_std_termios;
	driver->flags = TTY_DRIVER_REAL_RAW;

	tty_set_operations(driver, &nfcon_tty_ops);
	tty_port_link_device(&nfcon_tty_port, driver, 0);
+4 −5
Original line number Diff line number Diff line
@@ -161,9 +161,10 @@ static int __init pdc_console_tty_driver_init(void)
	printk(KERN_INFO "The PDC console driver is still registered, removing CON_BOOT flag\n");
	pdc_cons.flags &= ~CON_BOOT;

	driver = alloc_tty_driver(1);
	if (!driver)
		return -ENOMEM;
	driver = tty_alloc_driver(1, TTY_DRIVER_REAL_RAW |
			TTY_DRIVER_RESET_TERMIOS);
	if (IS_ERR(driver))
		return PTR_ERR(driver);

	tty_port_init(&tty_port);

@@ -173,8 +174,6 @@ static int __init pdc_console_tty_driver_init(void)
	driver->minor_start = 0;
	driver->type = TTY_DRIVER_TYPE_SYSTEM;
	driver->init_termios = tty_std_termios;
	driver->flags = TTY_DRIVER_REAL_RAW |
		TTY_DRIVER_RESET_TERMIOS;
	tty_set_operations(driver, &pdc_console_tty_ops);
	tty_port_link_device(&tty_port, driver, 0);

+6 −5
Original line number Diff line number Diff line
@@ -538,12 +538,14 @@ int register_lines(struct line_driver *line_driver,
		   const struct tty_operations *ops,
		   struct line *lines, int nlines)
{
	struct tty_driver *driver = alloc_tty_driver(nlines);
	struct tty_driver *driver;
	int err;
	int i;

	if (!driver)
		return -ENOMEM;
	driver = tty_alloc_driver(nlines, TTY_DRIVER_REAL_RAW |
			TTY_DRIVER_DYNAMIC_DEV);
	if (IS_ERR(driver))
		return PTR_ERR(driver);

	driver->driver_name = line_driver->name;
	driver->name = line_driver->device_name;
@@ -551,7 +553,6 @@ int register_lines(struct line_driver *line_driver,
	driver->minor_start = line_driver->minor_start;
	driver->type = line_driver->type;
	driver->subtype = line_driver->subtype;
	driver->flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_DYNAMIC_DEV;
	driver->init_termios = tty_std_termios;

	for (i = 0; i < nlines; i++) {
+3 −4
Original line number Diff line number Diff line
@@ -139,9 +139,9 @@ static int __init rs_init(void)
	struct tty_driver *driver;
	int ret;

	driver = alloc_tty_driver(SERIAL_MAX_NUM_LINES);
	if (!driver)
		return -ENOMEM;
	driver = tty_alloc_driver(SERIAL_MAX_NUM_LINES, TTY_DRIVER_REAL_RAW);
	if (IS_ERR(driver))
		return PTR_ERR(driver);

	tty_port_init(&serial_port);

@@ -156,7 +156,6 @@ static int __init rs_init(void)
	driver->init_termios = tty_std_termios;
	driver->init_termios.c_cflag =
		B9600 | CS8 | CREAD | HUPCL | CLOCAL;
	driver->flags = TTY_DRIVER_REAL_RAW;

	tty_set_operations(driver, &serial_ops);
	tty_port_link_device(&serial_port, driver, 0);
Loading