From: Matthew Howell <matthew.howell@xxxxxxxxxxxx> XR17V35X cards seemingly unable to register serial port. Confirmed on Sealevel 7202C, 7204EC, and Exar XR17V352 reference board. dmesg states: "Couldn't register serial port 0, irq 24, type 2, error -22" I first identified the problem when I pulled down 6.6-rc1 and I was able to trace it to d962de6ae51f9b76ad736220077cda83084090b1. I understand that this commit is noted as being reverted in 1ef2c2df1199, but I was only able to resolve the issue by reverting d962de6ae51f myself using this patch. I suggest reverting using this patch unless someone more knowledgeable about what these changes actually do has a better suggestion. Revert "serial: core: serial core port id to not use port->line" This reverts commit d962de6ae51f9b76ad736220077cda83084090b1 Link: https://lore.kernel.org/all/20230725054216.45696-3-tony@xxxxxxxxxxx/ Fixes: d962de6ae51f9b76ad736220077cda83084090b1 ("serial: core: Fix serial core port id to not use port->line") Signed-off-by: Matthew Howell <matthew.howell@xxxxxxxxxxxx> --- diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c index 3449f8790e46..ab4da98332ab 100644 --- a/drivers/tty/serial/8250/8250_core.c +++ b/drivers/tty/serial/8250/8250_core.c @@ -497,7 +497,6 @@ static struct uart_8250_port *serial8250_setup_port(int index) up = &serial8250_ports[index]; up->port.line = index; - up->port.port_id = index; serial8250_init_port(up); if (!base_ops) @@ -1041,7 +1040,6 @@ int serial8250_register_8250_port(const struct uart_8250_port *up) uart_remove_one_port(&serial8250_reg, &uart->port); uart->port.ctrl_id = up->port.ctrl_id; - uart->port.port_id = up->port.port_id; uart->port.iobase = up->port.iobase; uart->port.membase = up->port.membase; uart->port.irq = up->port.irq; diff --git a/drivers/tty/serial/serial_base_bus.c b/drivers/tty/serial/serial_base_bus.c index 3dfcf20c4eb6..53ae87ae337b 100644 --- a/drivers/tty/serial/serial_base_bus.c +++ b/drivers/tty/serial/serial_base_bus.c @@ -169,7 +169,8 @@ struct serial_port_device *serial_base_port_add(struct uart_port *port, err = serial_base_device_init(port, &port_dev->dev, &ctrl_dev->dev, &serial_port_type, serial_base_port_release, - port->ctrl_id, port->port_id); + port->line); + if (err) goto err_put_device; diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index a156d2ed8d9e..201813d888df 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -460,7 +460,6 @@ struct uart_port { int (*iso7816_config)(struct uart_port *, struct serial_iso7816 *iso7816); unsigned int ctrl_id; /* optional serial core controller id */ - unsigned int port_id; /* optional serial core port id */ unsigned int irq; /* irq number */ unsigned long irqflags; /* irq flags */ unsigned int uartclk; /* base uart clock */