From patchwork Tue Jul 2 14:01:27 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aaron Lu X-Patchwork-Id: 2812971 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 51F8FBF4A1 for ; Tue, 2 Jul 2013 14:01:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A541B2010A for ; Tue, 2 Jul 2013 14:01:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 64091200E9 for ; Tue, 2 Jul 2013 14:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751959Ab3GBOBP (ORCPT ); Tue, 2 Jul 2013 10:01:15 -0400 Received: from mga14.intel.com ([143.182.124.37]:11352 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751319Ab3GBOBO (ORCPT ); Tue, 2 Jul 2013 10:01:14 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by azsmga102.ch.intel.com with ESMTP; 02 Jul 2013 07:01:13 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.87,980,1363158000"; d="scan'208";a="359350297" Received: from aaronlu.sh.intel.com ([10.239.36.102]) by fmsmga001.fm.intel.com with ESMTP; 02 Jul 2013 07:01:42 -0700 Message-ID: <51D2DD37.2040000@intel.com> Date: Tue, 02 Jul 2013 22:01:27 +0800 From: Aaron Lu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130625 Thunderbird/17.0.7 MIME-Version: 1.0 To: Matthew Garrett , "Rafael J. Wysocki" CC: "linux-kernel@vger.kernel.org" , "linux-acpi@vger.kernel.org" , "seth.forshee@canonical.com" , "joeyli.kernel@gmail.com" , "daniel.vetter@ffwll.ch" , "lenb@kernel.org" , Bob Moore Subject: [PATCH 2/2] ACPI / OSL: add a wrapper function to return OSI version References: <1370818899-8595-1-git-send-email-matthew.garrett@nebula.com> <1371508629.523.3.camel@x230> <10189900.qsvQBSpnvI@vostro.rjw.lan> <2211483.MscZsfrrDc@vostro.rjw.lan> <51D2DC1D.60101@intel.com> In-Reply-To: <51D2DC1D.60101@intel.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Drivers may need to make policy decisions based on the OS that the firmware believes it's interacting with. ACPI firmware will make a series of _OSI calls, starting from the oldest OS version they support and ending with the most recent. This patchset adds a function in ACPI OSL layer to return the last successful call so that drivers know what the firmware's expecting. Based on a patch by Matthew Garrett , which is again based on a patch by Seth Forshee . Changelog-by: Matthew Garrett Signed-off-by: Aaron Lu Cc: Matthew Garrett Cc: Seth Forshee --- drivers/acpi/osl.c | 6 ++++++ include/linux/acpi.h | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index 6ab2c35..7ebf07d 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c @@ -1799,3 +1799,9 @@ void alloc_acpi_hp_work(acpi_handle handle, u32 type, void *context, kfree(hp_work); } EXPORT_SYMBOL_GPL(alloc_acpi_hp_work); + +u8 acpi_osi_version(void) +{ + return acpi_gbl_osi_data; +} +EXPORT_SYMBOL_GPL(acpi_osi_version); diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 353ba25..fc3b5c2 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -578,4 +578,10 @@ acpi_handle_printk(const char *level, void *handle, const char *fmt, ...) {} }) #endif +#ifdef CONFIG_ACPI +u8 acpi_osi_version(void); +#else +static inline u8 acpi_osi_version(void) { return 0; } +#endif + #endif /*_LINUX_ACPI_H*/