diff mbox

[Trusty/Utopic/Vivid,2/2] thinkpad_acpi: support new BIOS version string pattern

Message ID 1425278419-30682-2-git-send-email-adam.lee@canonical.com
State New
Headers show

Commit Message

Adam Lee March 2, 2015, 6:40 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1417915

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>
(cherry picked from commit 1b0eb5bc241354aa854671fdf02132d2d1452bdf)
Signed-off-by: Adam Lee <adam.lee@canonical.com>
---
 drivers/platform/x86/thinkpad_acpi.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

Comments

Andy Whitcroft March 10, 2015, 3:10 p.m. UTC | #1
Confirmed this is already Applied to vivid v3.19.

-apw
Adam Lee March 12, 2015, 5:17 a.m. UTC | #2
On Tue, Mar 10, 2015 at 03:10:48PM +0000, Andy Whitcroft wrote:
> Confirmed this is already Applied to vivid v3.19.
> 
> -apw

Still not in vivid git.. Patch 1 was already, but not patch 2.

http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-vivid.git;a=history;f=drivers/platform/x86/thinkpad_acpi.c;hb=HEAD
Andy Whitcroft March 12, 2015, 9:38 a.m. UTC | #3
On Thu, Mar 12, 2015 at 01:17:01PM +0800, Adam Lee wrote:
> On Tue, Mar 10, 2015 at 03:10:48PM +0000, Andy Whitcroft wrote:
> > Confirmed this is already Applied to vivid v3.19.
> > 
> > -apw
> 
> Still not in vivid git.. Patch 1 was already, but not patch 2.
> 
> http://kernel.ubuntu.com/git?p=ubuntu/ubuntu-vivid.git;a=history;f=drivers/platform/x86/thinkpad_acpi.c;hb=HEAD

Seems not indeed, odd.  Fixed.

-apw
diff mbox

Patch

diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index a5081f6..3942b83 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -8793,17 +8793,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.