From patchwork Wed Oct 12 23:32:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Chun-Yi Lee X-Patchwork-Id: 9374183 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4AB7C60839 for ; Thu, 13 Oct 2016 03:47:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 31CD12982F for ; Thu, 13 Oct 2016 03:47:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2630429830; Thu, 13 Oct 2016 03:47:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 775BF29831 for ; Thu, 13 Oct 2016 03:47:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933767AbcJMDq7 (ORCPT ); Wed, 12 Oct 2016 23:46:59 -0400 Received: from mail-pa0-f65.google.com ([209.85.220.65]:36690 "EHLO mail-pa0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933778AbcJMDq6 (ORCPT ); Wed, 12 Oct 2016 23:46:58 -0400 Received: by mail-pa0-f65.google.com with SMTP id os4so80935pac.3; Wed, 12 Oct 2016 20:46:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GB2KyMSZigT/9jMjfu8LmbPxPeRL9VY1bO8ey4DIuR0=; b=ABB/GiGEIwWWkgn7JrHnIE8Asr7Op1OzX83gp9Nxlg+G3DULUgYaxramfSz8Jj7EIJ cELI1zr9v5AwnkyNDreA1djt45IfdcELxshVee7be6ZjmRcArGN9+X2ron8Wmojw5L5Q WxqdL0753qPgFdPXWOEmVZjJYqcsALqprRgM763MHWMdnDj2nYZMnMn27UixLmL/XlJW yETLPDdt3oKXMj5Zj1Jl647jk5eWkW2h45zWYfRccc3YqUYWj3BRHAIG4M78ZoqKJd/2 NIurZA6mM/ylyk3Y6dOX12gkH0AZ9K04M/nzT/4JdYemGgGRsDXGHNRJeKfGN1q1V0eN UeQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=GB2KyMSZigT/9jMjfu8LmbPxPeRL9VY1bO8ey4DIuR0=; b=iK+YtMpmt9dqYtzF52g54zIFkOpw1ZRJsU/Ofy4Y9KkH04oh2a+3Tcq9i9RXjmp98C 99sCWMF8OS6YZJYeyeN0KCZvxF+JrKuBIGBclTsnC+QtNLhhs24va868aMSI4capgfCJ ec+uYTQB+myZYt4Igu8clKJ5I1oxRendGP2KfQij3rLMnyujmUWi3sIT1sVHaE6/UksU HWrQE/m60sqKtNb2B+1Jx1cj5q4nQIL5fBEcv+qaxWkVqNtDHwl49nsCdf9SOchIjeeg PLn9xkt564UtTjw4IOiAJNBr0OXwaM5XO9tkaXwq+fbp2RA+TIgOMk399hdNFTrh5T2t 6CUg== X-Gm-Message-State: AA6/9Rkd1GO1gslpeBTiPgyXyjd4wKhYeTGzPq7h9P+Lbf0b9CnpeNm4sO1UrnmgIO3plw== X-Received: by 10.66.89.4 with SMTP id bk4mr4688017pab.22.1476315348361; Wed, 12 Oct 2016 16:35:48 -0700 (PDT) Received: from linux-rxt1.site ([124.11.22.254]) by smtp.gmail.com with ESMTPSA id c135sm14321043pfc.28.2016.10.12.16.35.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 12 Oct 2016 16:35:47 -0700 (PDT) From: "Lee, Chun-Yi" X-Google-Original-From: "Lee, Chun-Yi" To: Darren Hart Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, "Lee, Chun-Yi" Subject: [PATCH] acer-wmi: only supports AMW0_GUID1 on acer family Date: Thu, 13 Oct 2016 07:32:18 +0800 Message-Id: <1476315138-20478-1-git-send-email-jlee@suse.com> X-Mailer: git-send-email 1.8.4.5 MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The AMW0_GUID1 wmi is not only found on Acer family but also other machines like Lenovo, Fujitsu and Medion. In the past days, acer-wmi driver handled those non-Acer machines by quirks list. But actually acer-wmi driver was loaded on any machines that have AMW0_GUID1. This behavior is strange because those machines should be supported by appropriate wmi drivers. e.g. fujitsu-laptop, ideapad-laptop. So, This patch adds the logic to check the machine that has AMW0_GUID1 should be in Acer/Packard Bell/Gateway white list. But, it still keeps the quirk list of those supported non-acer machines for backward compatible. Tested-by: Bjørn Mork Cc: Darren Hart Signed-off-by: Lee, Chun-Yi --- drivers/platform/x86/acer-wmi.c | 56 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 3bb3162..734f0da 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -355,6 +355,32 @@ static const struct dmi_system_id acer_blacklist[] __initconst = { {} }; +static const struct dmi_system_id amw0_whitelist[] __initconst = { + { + .ident = "Acer", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Acer"), + }, + }, + { + .ident = "Gateway", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Gateway"), + }, + }, + { + .ident = "Packard Bell", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Packard Bell"), + }, + }, + {} +}; + +/* + * This quirk table is only for Acer/Gateway/Packard Bell family + * that those machines are supported by acer-wmi driver. + */ static const struct dmi_system_id acer_quirks[] __initconst = { { .callback = dmi_matched, @@ -464,6 +490,17 @@ static const struct dmi_system_id acer_quirks[] __initconst = { }, .driver_data = &quirk_acer_travelmate_2490, }, + {} +}; + +/* + * This quirk list is for those non-acer machines that have AMW0_GUID1 + * but supported by acer-wmi in past days. Keeping this quirk list here + * is only for backward compatible. Please do not add new machine to + * here anymore. Those non-acer machines should be supported by + * appropriate wmi drivers. + */ +static const struct dmi_system_id non_acer_quirks[] __initconst = { { .callback = dmi_matched, .ident = "Fujitsu Siemens Amilo Li 1718", @@ -598,6 +635,7 @@ static void __init find_quirks(void) { if (!force_series) { dmi_check_system(acer_quirks); + dmi_check_system(non_acer_quirks); } else if (force_series == 2490) { quirks = &quirk_acer_travelmate_2490; } @@ -2121,6 +2159,24 @@ static int __init acer_wmi_init(void) find_quirks(); /* + * The AMW0_GUID1 wmi is not only found on Acer family but also other + * machines like Lenovo, Fujitsu and Medion. In the past days, + * acer-wmi driver handled those non-Acer machines by quirks list. + * But actually acer-wmi driver was loaded on any machines that have + * AMW0_GUID1. This behavior is strange because those machines should + * be supported by appropriate wmi drivers. e.g. fujitsu-laptop, + * ideapad-laptop. So, here checks the machine that has AMW0_GUID1 + * should be in Acer/Gateway/Packard Bell white list, or it's already + * in the past quirk list. + */ + if (wmi_has_guid(AMW0_GUID1) && + !dmi_check_system(amw0_whitelist) && + quirks == &quirk_unknown) { + pr_err("Unsupported machine has AMW0_GUID1, unable to load\n"); + return -ENODEV; + } + + /* * Detect which ACPI-WMI interface we're using. */ if (wmi_has_guid(AMW0_GUID1) && wmi_has_guid(WMID_GUID1))