mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 02:30:34 +02:00 
			
		
		
		
	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: 1ef2c2df11 ("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>
			
			
This commit is contained in:
		
							parent
							
								
									1ef2c2df11
								
							
						
					
					
						commit
						7d695d8376
					
				
					 1 changed files with 8 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -29,9 +29,15 @@ static const struct device_type serial_port_type = {
 | 
			
		|||
 | 
			
		||||
static int serial_base_match(struct device *dev, struct device_driver *drv)
 | 
			
		||||
{
 | 
			
		||||
	int len = strlen(drv->name);
 | 
			
		||||
	if (dev->type == &serial_ctrl_type &&
 | 
			
		||||
	    str_has_prefix(drv->name, serial_ctrl_type.name))
 | 
			
		||||
		return 1;
 | 
			
		||||
 | 
			
		||||
	return !strncmp(dev_name(dev), drv->name, len);
 | 
			
		||||
	if (dev->type == &serial_port_type &&
 | 
			
		||||
	    str_has_prefix(drv->name, serial_port_type.name))
 | 
			
		||||
		return 1;
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static struct bus_type serial_base_bus_type = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue