Skip to contentSkip to conversation

USB: serial: use tty_port_register_device()

PATCH Johan Hovold 1 participant 1 message May 16, 2018

Subsystems (2)
lore
Share & tools
lore

Johan Hovold

author maintainer
#0 lore raw

We already have the tty port when probing a usb-serial port so use tty_port_register_device() directly instead of tty_port_install() later to set up the port link.

This is a step towards enabling serdev for usb-serial (but we need to determine how to handle hotplugging first).

---
 drivers/usb/serial/bus.c        | 3 ++-
 drivers/usb/serial/usb-serial.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/usb/serial/bus.c +2 -1
index 9e265eb92611..eb0195cf37dd 100644
@@ -60,7 +60,8 @@ static int usb_serial_device_probe(struct device *dev)
 	}
 
 	minor = port->minor;
-	tty_dev = tty_register_device(usb_serial_tty_driver, minor, dev);
+	tty_dev = tty_port_register_device(&port->port, usb_serial_tty_driver,
+					   minor, dev);
 	if (IS_ERR(tty_dev)) {
 		retval = PTR_ERR(tty_dev);
 		goto err_port_remove;
drivers/usb/serial/usb-serial.c +1 -1
index 790e0cbe3da9..44ecf0e2be9d 100644
@@ -192,7 +192,7 @@ static int serial_install(struct tty_driver *driver, struct tty_struct *tty)
 	if (retval)
 		goto error_get_interface;
 
-	retval = tty_port_install(&port->port, driver, tty);
+	retval = tty_standard_install(driver, tty);
 	if (retval)
 		goto error_init_termios;