From patchwork Mon Mar 2 06:40:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Lee X-Patchwork-Id: 444928 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 246EF14015A; Mon, 2 Mar 2015 17:40:41 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1YSK1q-0008ML-76; Mon, 02 Mar 2015 06:40:34 +0000 Received: from mail-pa0-f45.google.com ([209.85.220.45]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1YSK1l-0008Lg-5l for kernel-team@lists.ubuntu.com; Mon, 02 Mar 2015 06:40:29 +0000 Received: by pablj1 with SMTP id lj1so5511897pab.8 for ; Sun, 01 Mar 2015 22:40:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=6+gUpLEtjeNn8VgAMn9Dl7V+Rv/36fJrRHFYvF+QEOA=; b=iamhMouIrwnR9Nl21hxaCbwjUG+dDX0op+7nTAScjZ7VB9aHmZ+ZsfW1/a5IbwoCsy qDEiFXluwrb+9fCQk9hTuPfm6mWYrUCyWXoKkJvUyukUTjMEc1a/9lxMAXajyQsvsfVX 5ve8JWywJRd2P/y8ITSJjrLFra7thSMYm7oKEGTzcvoznWFEDqh5O3lVHECHjSyQEM+R KOVF0LyMHMEaLeE3+F204FpNoZbXIHOtUjeJZdzkI3uSqpjIy/45M7gZjDAwb1T1kaxa Ibe9TOLvWMxDP/zaeZ3+xbvsV8c3w0gzGT0Vu1/orpEFD+Jzhtt0XYuIeRm/HcbcnST3 /xrQ== X-Gm-Message-State: ALoCoQkA4PpxjwGGuTgRHqE8/eC0Fm0nD5k+XtKRR2c3r5bR8gLa+yYsqDVZn/on/BC/bz/uGZrA X-Received: by 10.70.131.41 with SMTP id oj9mr21044644pdb.12.1425278428287; Sun, 01 Mar 2015 22:40:28 -0800 (PST) Received: from localhost ([116.213.191.74]) by mx.google.com with ESMTPSA id vf6sm10847398pbc.18.2015.03.01.22.40.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Mar 2015 22:40:27 -0800 (PST) From: Adam Lee To: kernel-team@lists.ubuntu.com Subject: [Trusty/Utopic/Vivid][PATCH 2/2] thinkpad_acpi: support new BIOS version string pattern Date: Mon, 2 Mar 2015 14:40:19 +0800 Message-Id: <1425278419-30682-2-git-send-email-adam.lee@canonical.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1425278419-30682-1-git-send-email-adam.lee@canonical.com> References: <1425278419-30682-1-git-send-email-adam.lee@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com 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 Intentatation cleanup. Signed-off-by: Darren Hart (cherry picked from commit 1b0eb5bc241354aa854671fdf02132d2d1452bdf) Signed-off-by: Adam Lee --- drivers/platform/x86/thinkpad_acpi.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) 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.