Skip to content

Commit bbb4abb

Browse files
tmlindgregkh
authored andcommitted
serial: 8250: Reinit port_id when adding back serial8250_isa_devs
After fixing the serial core port device to use port->port_id instead of port->line, unloading a hardware specific 8250 port driver started producing an error for "sysfs: cannot create duplicate filename". This is happening as we are wrongly initializing port->port_id to zero when adding back serial8250_isa_devs instances, and the serial8250:0.0 sysfs entry may already exist. For serial8250 devices, we typically have multiple devices mapped to a single driver instance. For the serial8250_isa_devs instances, the port->port_id is the same as port->line. Let's fix the issue by re-initializing port_id when adding back the serial8250_isa_devs instances in serial8250_unregister_port(). Fixes: d962de6 ("serial: core: Fix serial core port id to not use port->line") Signed-off-by: Tony Lindgren <tony@atomide.com> Link: https://lore.kernel.org/r/20230804123546.25293-1-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 6be1a8d commit bbb4abb

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,7 @@ void serial8250_unregister_port(int line)
12041204
uart->port.flags &= ~UPF_BOOT_AUTOCONF;
12051205
uart->port.type = PORT_UNKNOWN;
12061206
uart->port.dev = &serial8250_isa_devs->dev;
1207+
uart->port.port_id = line;
12071208
uart->capabilities = 0;
12081209
serial8250_init_port(uart);
12091210
serial8250_apply_quirks(uart);

0 commit comments

Comments
 (0)