From patchwork Mon Aug 29 09:55:53 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: 9303381 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 6EBE0601C0 for ; Mon, 29 Aug 2016 09:58:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E66E284FF for ; Mon, 29 Aug 2016 09:58:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 51AF62874C; Mon, 29 Aug 2016 09:58:08 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, 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 48E02284FF for ; Mon, 29 Aug 2016 09:58:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932448AbcH2J6G (ORCPT ); Mon, 29 Aug 2016 05:58:06 -0400 Received: from mail-pa0-f68.google.com ([209.85.220.68]:35262 "EHLO mail-pa0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756756AbcH2J6E (ORCPT ); Mon, 29 Aug 2016 05:58:04 -0400 Received: by mail-pa0-f68.google.com with SMTP id cf3so8704394pad.2; Mon, 29 Aug 2016 02:58:01 -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=o99r/V02AWFEExTYRoPSGQ6+2wNK+A45a2Bj4wqs1+0=; b=NaPM3asSg+Rvs60D19ifsu6L4vb7y7uEfEWxOnxqc6m2PEzka307/qBDxMpRbpED8d eUH0B5Y9WuCcrSzCmNYbwKy7+1lxj9O6PrZi+B1XqVZODI/6tt/12EpG04mppYhlQ5lD 40NJLn9S2os9FCSou+4TiL1cxj/k0OfLh0/IUKl/d3JEy6vDS78NGbYWR9A44P/I+PRg oDjB9sWiEXI3YJZ7cHq9WDTiCMJmJGbH4EoSdgNmmPHjRz2Y6xJwikJf9GxRsci1vG6/ 4qthHUQigicY5G+JR28v+q9Ztt2vBjHTJL5Ym2TBMUQQoXO4iijT48iLsXmpITrTTeVr Hg6w== 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=o99r/V02AWFEExTYRoPSGQ6+2wNK+A45a2Bj4wqs1+0=; b=NfjXHZ5Wd8i4q0RTVpUmDZy+ZKXwqDT6vEDbvDoTcA3wZiYkx8CovIR022hcjdgK3R 9s3hfK6j6TsNMkEbum/XfqTze7zQaL5gOpOjEwR/QV0GCS29KpmzyVQ/HCJQv1mOthDW o0ICDg+um6aTBbntqvm24Jot3nXQW+1WYMmq6A8FqudlNPjOLc8iWAMNZUCIUK7LtNFJ 4I7fFx6ulUVu4h9oDJt4+mWx0hVmWjID8LebrSypmPUK0G5nNnDQGthe3mCMiHvk1Tjt w7VtKcBHFJvKn9pxCpBbzLqauywZPC9huyU5wWaCMOboh+GxotZ4WKpYMY4yrgxxvJzj svFw== X-Gm-Message-State: AE9vXwMBg6hIW3uCp2JegXwRpFVYEVEciUK0Gq22eai1AVVaMpWIIMOXkgmEuiLL4dCo6Q== X-Received: by 10.66.216.69 with SMTP id oo5mr31035157pac.155.1472464680772; Mon, 29 Aug 2016 02:58:00 -0700 (PDT) Received: from linux-rxt1.site (59-124-67-67.HINET-IP.hinet.net. [59.124.67.67]) by smtp.gmail.com with ESMTPSA id yv9sm47955530pab.0.2016.08.29.02.57.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Aug 2016 02:58:00 -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" , =?UTF-8?q?Bj=C3=B8rn=20Mork?= Subject: [PATCH] acer-wmi: only supports AMW0_GUID1 on acer family Date: Mon, 29 Aug 2016 17:55:53 +0800 Message-Id: <1472464553-9922-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. Cc: Bjørn Mork Cc: Darren Hart Signed-off-by: Lee, Chun-Yi Tested-by: Bjørn Mork --- 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))