Skip to content

Commit 7d695d8

Browse files
tmlindgregkh
authored andcommitted
serial: core: Fix serial_base_match() after fixing controller port name
While fixing DEVNAME to be more usable, I broke serial_base_match() as the ctrl and port prefix for device names seemed unnecessary. The prefixes are still needed by serial_base_match() to probe the serial base controller port, and serial tx is now broken. Let's fix the issue by checking against dev->type and drv->name instead of the prefixes that are no longer in the DEVNAME. Fixes: 1ef2c2d ("serial: core: Fix serial core controller port name to show controller id") Reported-by: kernel test robot <oliver.sang@intel.com> Closes: https://lore.kernel.org/oe-lkp/202308021529.35b3ad6c-oliver.sang@intel.com Signed-off-by: Tony Lindgren <tony@atomide.com> Reviewed-by: Jiri Slaby <jirislaby@kernel.org> Link: https://lore.kernel.org/r/20230803071034.25571-1-tony@atomide.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 1ef2c2d commit 7d695d8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/tty/serial/serial_base_bus.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ static const struct device_type serial_port_type = {
2929

3030
static int serial_base_match(struct device *dev, struct device_driver *drv)
3131
{
32-
int len = strlen(drv->name);
32+
if (dev->type == &serial_ctrl_type &&
33+
str_has_prefix(drv->name, serial_ctrl_type.name))
34+
return 1;
3335

34-
return !strncmp(dev_name(dev), drv->name, len);
36+
if (dev->type == &serial_port_type &&
37+
str_has_prefix(drv->name, serial_port_type.name))
38+
return 1;
39+
40+
return 0;
3541
}
3642

3743
static struct bus_type serial_base_bus_type = {

0 commit comments

Comments
 (0)