From patchwork Thu Jul 13 22:36:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Wunner X-Patchwork-Id: 9839651 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 D02FE602D8 for ; Thu, 13 Jul 2017 22:36:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ECD9D27F8F for ; Thu, 13 Jul 2017 22:36:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E18742808F; Thu, 13 Jul 2017 22:36:51 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI 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 5C41927F8F for ; Thu, 13 Jul 2017 22:36:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753059AbdGMWgt (ORCPT ); Thu, 13 Jul 2017 18:36:49 -0400 Received: from mailout1.hostsharing.net ([83.223.95.204]:60431 "EHLO mailout1.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753022AbdGMWgr (ORCPT ); Thu, 13 Jul 2017 18:36:47 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout1.hostsharing.net (Postfix) with ESMTPS id 2ACB71018D6DC; Fri, 14 Jul 2017 00:36:45 +0200 (CEST) Received: from localhost (5-38-90-81.adsl.cmo.de [81.90.38.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id C086B604DB65; Fri, 14 Jul 2017 00:36:43 +0200 (CEST) X-Mailbox-Line: From 6dad5b18be68f1b7abb243ec04383bb7011f1ca3 Mon Sep 17 00:00:00 2001 Message-Id: <6dad5b18be68f1b7abb243ec04383bb7011f1ca3.1499983092.git.lukas@wunner.de> In-Reply-To: References: From: Lukas Wunner Date: Fri, 14 Jul 2017 00:36:19 +0200 Subject: [PATCH v3 1/6] ACPI / osi: Exclude x86 DMI quirks on other arches To: "Rafael J. Wysocki" Cc: Ronald Tschalaer , Federico Lorenzi , Mika Westerberg , Andy Shevchenko , Lv Zheng , Leif Liddy , Daniel Roschka , Mark Brown , linux-acpi@vger.kernel.org, linux-spi@vger.kernel.org Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP All existing quirks in acpi_osi_dmi_table[] as well as their callbacks are specific to x86 so exclude them on other arches. The simplest approach is to #ifdef the DMI quirks. An alternative would be to declare a __weak empty table which can be overridden per arch. The ability to specify "acpi_osi=Linux" and "acpi_osi=Darwin" on the command line is retained, though its usefulness on non-x86 arches is debatable. (Do we really need to return false to _OSI(Linux) on non-x86 arches as well?) Beyond that the ACPI core contains various other x86-specific quirks (such as video_detect_dmi_table[]) and a bigger effort is needed to achieve a clean separation of generic and arch-specific code. Cc: Lv Zheng Signed-off-by: Lukas Wunner --- Changes v2 -> v3: - Newly inserted patch in v3 to avoid repeated DMI checks for Apple hardware: The result of the first DMI check in osi.c is cached. Two other existing DMI checks are converted to use the result. Because one of them is in a module (sbs.ko), the bool is_apple_system needs to be exported. On non-x86, the DMI checks and Apple-specific code are omitted altogether. (Andy, Rafael) drivers/acpi/osi.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/acpi/osi.c b/drivers/acpi/osi.c index 723bee58bbcf..cd953ae10238 100644 --- a/drivers/acpi/osi.c +++ b/drivers/acpi/osi.c @@ -257,6 +257,7 @@ bool acpi_osi_is_win8(void) } EXPORT_SYMBOL(acpi_osi_is_win8); +#ifdef CONFIG_X86 static void __init acpi_osi_dmi_darwin(bool enable, const struct dmi_system_id *d) { @@ -312,6 +313,7 @@ static int __init dmi_disable_osi_win8(const struct dmi_system_id *d) return 0; } +#endif /* CONFIG_X86 */ /* * Linux default _OSI response behavior is determined by this DMI table. @@ -320,6 +322,7 @@ static int __init dmi_disable_osi_win8(const struct dmi_system_id *d) * by acpi_osi=!Linux/acpi_osi=!Darwin command line options. */ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { +#ifdef CONFIG_X86 { .callback = dmi_disable_osi_vista, .ident = "Fujitsu Siemens", @@ -499,6 +502,7 @@ static struct dmi_system_id acpi_osi_dmi_table[] __initdata = { DMI_MATCH(DMI_SYS_VENDOR, "Apple Computer, Inc."), }, }, +#endif /* CONFIG_X86 */ {} };