Skip to content

Commit d962de6

Browse files
tmlindgregkh
authored andcommitted
serial: core: Fix serial core port id to not use port->line
The serial core port id should be serial core controller specific port instance, which is not always the port->line index. For example, 8250 driver maps a number of legacy ports, and when a hardware specific device driver takes over, we typically have one driver instance for each port. Let's instead add port->port_id to keep track serial ports mapped to each serial core controller instance. Currently this is only a cosmetic issue for the serial core port device names. The issue can be noticed looking at /sys/bus/serial-base/devices for example though. Let's fix the issue to avoid port addressing issues later on. Fixes: 84a9582 ("serial: core: Start managing serial controllers to enable runtime PM") Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Tony Lindgren <tony@atomide.com> Link: https://lore.kernel.org/r/20230725054216.45696-3-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 83c3518 commit d962de6

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

drivers/tty/serial/8250/8250_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ static struct uart_8250_port *serial8250_setup_port(int index)
497497

498498
up = &serial8250_ports[index];
499499
up->port.line = index;
500+
up->port.port_id = index;
500501

501502
serial8250_init_port(up);
502503
if (!base_ops)
@@ -1040,6 +1041,7 @@ int serial8250_register_8250_port(const struct uart_8250_port *up)
10401041
uart_remove_one_port(&serial8250_reg, &uart->port);
10411042

10421043
uart->port.ctrl_id = up->port.ctrl_id;
1044+
uart->port.port_id = up->port.port_id;
10431045
uart->port.iobase = up->port.iobase;
10441046
uart->port.membase = up->port.membase;
10451047
uart->port.irq = up->port.irq;

drivers/tty/serial/serial_base_bus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ struct serial_port_device *serial_base_port_add(struct uart_port *port,
136136
err = serial_base_device_init(port, &port_dev->dev,
137137
&ctrl_dev->dev, &serial_port_type,
138138
serial_base_port_release,
139-
port->line);
139+
port->port_id);
140140
if (err)
141141
goto err_put_device;
142142

include/linux/serial_core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,7 @@ struct uart_port {
460460
int (*iso7816_config)(struct uart_port *,
461461
struct serial_iso7816 *iso7816);
462462
unsigned int ctrl_id; /* optional serial core controller id */
463+
unsigned int port_id; /* optional serial core port id */
463464
unsigned int irq; /* irq number */
464465
unsigned long irqflags; /* irq flags */
465466
unsigned int uartclk; /* base uart clock */

0 commit comments

Comments
 (0)