[PATCH] USB: serial: Support attaching serdev devices

From: Alban Bedel

Date: Thu Sep 17 2026 - 04:14:41 EST


Use tty_port_register_device_serdev() to allow attaching serdev
devices to USB serial ports. Also set the ACPI companion device on the
USB serial device to let the serdev matching work on ACPI systems.

Signed-off-by: Alban Bedel <alban.bedel@xxxxxxxxxx>
---
drivers/usb/serial/bus.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index 9e2a18c0b2183..0b0a5ea1ba5aa 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -6,6 +6,7 @@
*/

#include <linux/kernel.h>
+#include <linux/acpi.h>
#include <linux/errno.h>
#include <linux/tty.h>
#include <linux/slab.h>
@@ -49,9 +50,13 @@ static int usb_serial_device_probe(struct device *dev)
goto err_autopm_put;
}

+ ACPI_COMPANION_SET(dev, ACPI_COMPANION(&port->serial->dev->dev));
+
minor = port->minor;
- tty_dev = tty_port_register_device(&port->port, usb_serial_tty_driver,
- minor, dev);
+ tty_dev = tty_port_register_device_serdev(&port->port,
+ usb_serial_tty_driver,
+ minor, dev,
+ &port->serial->dev->dev);
if (IS_ERR(tty_dev)) {
retval = PTR_ERR(tty_dev);
goto err_port_remove;
--
2.39.5