Re: [PATCH] serial: core: Fix serial core port id to not use port->line

From: Jiri Slaby
Date: Wed Jul 19 2023 - 01:26:53 EST


On 19. 07. 23, 7:12, Tony Lindgren wrote:
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.

...
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -460,6 +460,7 @@ struct uart_port {
int (*iso7816_config)(struct uart_port *,
struct serial_iso7816 *iso7816);
int ctrl_id; /* optional serial core controller id */
+ int port_id; /* optional serial core port id */

Can the id be negative? If not, please use uint.

thanks,
--
js
suse labs