mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	thinkpad_acpi: support new BIOS version string pattern
Latest ThinkPad models use a new string pattern of BIOS version, thinkpad_acpi won't be loaded automatically without this fix. Signed-off-by: Adam Lee <adam.lee@canonical.com> Intentatation cleanup. Signed-off-by: Darren Hart <dvhart@linux.intel.com>
This commit is contained in:
		
							parent
							
								
									67ab62481c
								
							
						
					
					
						commit
						1b0eb5bc24
					
				
					 1 changed files with 17 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -8885,17 +8885,31 @@ static bool __pure __init tpacpi_is_fw_digit(const char c)
 | 
			
		|||
	return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Most models: xxyTkkWW (#.##c); Ancient 570/600 and -SL lacks (#.##c) */
 | 
			
		||||
static bool __pure __init tpacpi_is_valid_fw_id(const char * const s,
 | 
			
		||||
						const char t)
 | 
			
		||||
{
 | 
			
		||||
	return s && strlen(s) >= 8 &&
 | 
			
		||||
	/*
 | 
			
		||||
	 * Most models: xxyTkkWW (#.##c)
 | 
			
		||||
	 * Ancient 570/600 and -SL lacks (#.##c)
 | 
			
		||||
	 */
 | 
			
		||||
	if (s && strlen(s) >= 8 &&
 | 
			
		||||
		tpacpi_is_fw_digit(s[0]) &&
 | 
			
		||||
		tpacpi_is_fw_digit(s[1]) &&
 | 
			
		||||
		s[2] == t &&
 | 
			
		||||
		(s[3] == 'T' || s[3] == 'N') &&
 | 
			
		||||
		tpacpi_is_fw_digit(s[4]) &&
 | 
			
		||||
		tpacpi_is_fw_digit(s[5]);
 | 
			
		||||
		tpacpi_is_fw_digit(s[5]))
 | 
			
		||||
		return true;
 | 
			
		||||
 | 
			
		||||
	/* New models: xxxyTkkW (#.##c); T550 and some others */
 | 
			
		||||
	return s && strlen(s) >= 8 &&
 | 
			
		||||
		tpacpi_is_fw_digit(s[0]) &&
 | 
			
		||||
		tpacpi_is_fw_digit(s[1]) &&
 | 
			
		||||
		tpacpi_is_fw_digit(s[2]) &&
 | 
			
		||||
		s[3] == t &&
 | 
			
		||||
		(s[4] == 'T' || s[4] == 'N') &&
 | 
			
		||||
		tpacpi_is_fw_digit(s[5]) &&
 | 
			
		||||
		tpacpi_is_fw_digit(s[6]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* returns 0 - probe ok, or < 0 - probe error.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue