lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240807-v6-10-topic-usb-serial-serdev-v1-3-ed2cc5da591f@pengutronix.de>
Date: Wed, 07 Aug 2024 16:08:50 +0200
From: Marco Felsch <m.felsch@...gutronix.de>
To: Rob Herring <robh@...nel.org>, 
 Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
 Jiri Slaby <jirislaby@...nel.org>, Johan Hovold <johan@...nel.org>
Cc: linux-serial@...r.kernel.org, linux-kernel@...r.kernel.org, 
 linux-usb@...r.kernel.org, Marco Felsch <m.felsch@...gutronix.de>
Subject: [PATCH 3/3] USB: serial: enable serdev support

Enable serdev support by using the serdev opt-in tty-port registration
helper.

Signed-off-by: Marco Felsch <m.felsch@...gutronix.de>
---
 drivers/usb/serial/bus.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index df0196a30f33..84eca07f83fa 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -33,6 +33,7 @@ static int usb_serial_device_probe(struct device *dev)
 {
 	struct usb_serial_port *port = to_usb_serial_port(dev);
 	struct usb_serial_driver *driver;
+	struct device *host_dev;
 	struct device *tty_dev;
 	int retval = 0;
 	int minor;
@@ -50,8 +51,9 @@ static int usb_serial_device_probe(struct device *dev)
 	}
 
 	minor = port->minor;
-	tty_dev = tty_port_register_device(&port->port, usb_serial_tty_driver,
-					   minor, dev);
+	host_dev = &port->serial->interface->dev;
+	tty_dev = tty_port_register_device_serdev(&port->port,
+			usb_serial_tty_driver, minor, host_dev, dev);
 	if (IS_ERR(tty_dev)) {
 		retval = PTR_ERR(tty_dev);
 		goto err_port_remove;
@@ -90,7 +92,7 @@ static void usb_serial_device_remove(struct device *dev)
 	autopm_err = usb_autopm_get_interface(port->serial->interface);
 
 	minor = port->minor;
-	tty_unregister_device(usb_serial_tty_driver, minor);
+	tty_port_unregister_device(&port->port, usb_serial_tty_driver, minor);
 
 	driver = port->serial->type;
 	if (driver->port_remove)

-- 
2.39.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ