From patchwork Sat Sep 12 18:22:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Henrique de Moraes Holschuh X-Patchwork-Id: 47096 X-Patchwork-Delegate: lenb@kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8CIMRJO018286 for ; Sat, 12 Sep 2009 18:22:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754543AbZILSWX (ORCPT ); Sat, 12 Sep 2009 14:22:23 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754640AbZILSWW (ORCPT ); Sat, 12 Sep 2009 14:22:22 -0400 Received: from out1.smtp.messagingengine.com ([66.111.4.25]:54949 "EHLO out1.smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754543AbZILSWW (ORCPT ); Sat, 12 Sep 2009 14:22:22 -0400 Received: from compute1.internal (compute1.internal [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 0EB3C6BAFE; Sat, 12 Sep 2009 14:22:25 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Sat, 12 Sep 2009 14:22:25 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=from:to:cc:subject:date:message-id:in-reply-to:references; s=smtpout; bh=yn9sEXSqszDnsMR/UnisiGpDQ10=; b=XMJgNkxUWHo2Da2m5qBWuv/+RAER7QzKCSPEuIqRWKuaa2HtBW2yK9LGeoecsX6ApFGGLqZyED+QZP2qqDMoDGQBQFNXAHgLPGhA3BPns3F5a9/hAYuuyNWlfhbkhGsWit08hNUBEJxwFI3/pS2sOMUBB2pBvETf8A2RFaLdCpQ= X-Sasl-enc: s1LoOH/2irvI8aBZrbnZsojQxhpQKwgsYmpDc0AD5u4n 1252779744 Received: from thorin.khazad-dum.debian.net (unknown [201.82.170.176]) by mail.messagingengine.com (Postfix) with ESMTPSA id 9F94C361A5; Sat, 12 Sep 2009 14:22:24 -0400 (EDT) Received: by thorin.khazad-dum.debian.net (Postfix, from userid 1000) id D46141E93F2; Sat, 12 Sep 2009 15:22:22 -0300 (BRT) From: Henrique de Moraes Holschuh To: Len Brown Cc: linux-acpi@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net, Henrique de Moraes Holschuh Subject: [PATCH 3/8] thinkpad-acpi: be more strict when detecting a ThinkPad Date: Sat, 12 Sep 2009 15:22:13 -0300 Message-Id: <1252779738-7459-4-git-send-email-hmh@hmh.eng.br> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1252779738-7459-1-git-send-email-hmh@hmh.eng.br> References: <1252779738-7459-1-git-send-email-hmh@hmh.eng.br> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Use stricter checks to decide that we're running on a supported ThinkPad. This should remove some possible false positives, although nobody ever bothered to report any. Signed-off-by: Henrique de Moraes Holschuh --- drivers/platform/x86/thinkpad_acpi.c | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c index cc4155c..d69ab3f 100644 --- a/drivers/platform/x86/thinkpad_acpi.c +++ b/drivers/platform/x86/thinkpad_acpi.c @@ -1621,6 +1621,9 @@ static void tpacpi_remove_driver_attributes(struct device_driver *drv) * * Sources: IBM ThinkPad Public Web Documents (update changelogs), * Information from users in ThinkWiki + * + * WARNING: we use this table also to detect that the machine is + * a ThinkPad in some cases, so don't remove entries lightly. */ #define TPV_Q(__v, __id1, __id2, __bv1, __bv2) \ @@ -1782,6 +1785,12 @@ static void __init tpacpi_check_outdated_fw(void) } } +static bool __init tpacpi_is_fw_known(void) +{ + return tpacpi_check_quirks(tpacpi_bios_version_qtable, + ARRAY_SIZE(tpacpi_bios_version_qtable)) != 0; +} + /**************************************************************************** **************************************************************************** * @@ -7706,9 +7715,11 @@ static int __init probe_for_thinkpad(void) /* * Non-ancient models have better DMI tagging, but very old models - * don't. + * don't. tpacpi_is_fw_known() is a cheat to help in that case. */ - is_thinkpad = (thinkpad_id.model_str != NULL); + is_thinkpad = (thinkpad_id.model_str != NULL) || + (thinkpad_id.ec_model != 0) || + tpacpi_is_fw_known(); /* ec is required because many other handles are relative to it */ TPACPI_ACPIHANDLE_INIT(ec); @@ -7719,13 +7730,6 @@ static int __init probe_for_thinkpad(void) return -ENODEV; } - /* - * Risks a regression on very old machines, but reduces potential - * false positives a damn great deal - */ - if (!is_thinkpad) - is_thinkpad = (thinkpad_id.vendor == PCI_VENDOR_ID_IBM); - if (!is_thinkpad && !force_load) return -ENODEV;