From patchwork Fri Jul 30 06:20:15 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kenji Kaneshige X-Patchwork-Id: 115405 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6U6KtH1009840 for ; Fri, 30 Jul 2010 06:20:56 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754715Ab0G3GUy (ORCPT ); Fri, 30 Jul 2010 02:20:54 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:55417 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752285Ab0G3GUx (ORCPT ); Fri, 30 Jul 2010 02:20:53 -0400 Received: from m4.gw.fujitsu.co.jp ([10.0.50.74]) by fgwmail5.fujitsu.co.jp (Fujitsu Gateway) with ESMTP id o6U6KqD4024490 (envelope-from kaneshige.kenji@jp.fujitsu.com); Fri, 30 Jul 2010 15:20:52 +0900 Received: from smail (m4 [127.0.0.1]) by outgoing.m4.gw.fujitsu.co.jp (Postfix) with ESMTP id D01B545DE6F; Fri, 30 Jul 2010 15:20:51 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (s4.gw.fujitsu.co.jp [10.0.50.94]) by m4.gw.fujitsu.co.jp (Postfix) with ESMTP id 96E9A45DE6E; Fri, 30 Jul 2010 15:20:51 +0900 (JST) Received: from s4.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 7AEE81DB803A; Fri, 30 Jul 2010 15:20:51 +0900 (JST) Received: from m105.s.css.fujitsu.com (m105.s.css.fujitsu.com [10.249.87.105]) by s4.gw.fujitsu.co.jp (Postfix) with ESMTP id 1F98C1DB803E; Fri, 30 Jul 2010 15:20:48 +0900 (JST) Received: from m105.css.fujitsu.com (m105 [127.0.0.1]) by m105.s.css.fujitsu.com (Postfix) with ESMTP id CF46D5D8008; Fri, 30 Jul 2010 15:20:47 +0900 (JST) Received: from [127.0.0.1] (unknown [10.124.102.21]) by m105.s.css.fujitsu.com (Postfix) with ESMTP id 4D8895D8009; Fri, 30 Jul 2010 15:20:47 +0900 (JST) X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Received: from KANE-LIFEBOOK[10.124.102.21] by KANE-LIFEBOOK (FujitsuOutboundMailChecker v1.3.1/9992[10.124.102.21]); Fri, 30 Jul 2010 15:20:25 +0900 (JST) Message-ID: <4C526F1F.6060701@jp.fujitsu.com> Date: Fri, 30 Jul 2010 15:20:15 +0900 From: Kenji Kaneshige User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; ja; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 MIME-Version: 1.0 To: "Rafael J. Wysocki" CC: Jesse Barnes , Len Brown , ACPI Devel Maling List , linux-pm@lists.linux-foundation.org, linux-pci@vger.kernel.org, Matthew Garrett , Hidetoshi Seto Subject: [PATCH 1/6] ACPI/PCI: cleanup acpi_pci_run_osc References: <201007282323.56351.rjw@sisk.pl> <20100728144358.5e2c12ce@virtuousgeek.org> <4C510B90.9070302@jp.fujitsu.com> <201007291745.39285.rjw@sisk.pl> <4C526A85.3070902@jp.fujitsu.com> <4C526E3E.3000600@jp.fujitsu.com> In-Reply-To: <4C526E3E.3000600@jp.fujitsu.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 30 Jul 2010 06:20:57 +0000 (UTC) Index: linux-2.6.35-rc6/drivers/acpi/pci_root.c =================================================================== --- linux-2.6.35-rc6.orig/drivers/acpi/pci_root.c +++ linux-2.6.35-rc6/drivers/acpi/pci_root.c @@ -206,9 +206,10 @@ static void acpi_pci_bridge_scan(struct static u8 pci_osc_uuid_str[] = "33DB4D5B-1FF7-401C-9657-7441C03DD766"; -static acpi_status acpi_pci_run_osc(acpi_handle handle, - const u32 *capbuf, u32 *retval) +static acpi_status acpi_pci_run_osc(acpi_handle handle, u32 support, + u32 control, bool query, u32 *retval) { + u32 capbuf[3]; struct acpi_osc_context context = { .uuid_str = pci_osc_uuid_str, .rev = 1, @@ -217,6 +218,10 @@ static acpi_status acpi_pci_run_osc(acpi }; acpi_status status; + capbuf[OSC_QUERY_TYPE] = (query == true) ? OSC_QUERY_ENABLE : 0; + capbuf[OSC_SUPPORT_TYPE] = support; + capbuf[OSC_CONTROL_TYPE] = control; + status = acpi_run_osc(handle, &context); if (ACPI_SUCCESS(status)) { *retval = *((u32 *)(context.ret.pointer + 8)); @@ -228,17 +233,16 @@ static acpi_status acpi_pci_run_osc(acpi static acpi_status acpi_pci_query_osc(struct acpi_pci_root *root, u32 flags) { acpi_status status; - u32 support_set, result, capbuf[3]; + u32 result; /* do _OSC query for all possible controls */ - support_set = root->osc_support_set | (flags & OSC_PCI_SUPPORT_MASKS); - capbuf[OSC_QUERY_TYPE] = OSC_QUERY_ENABLE; - capbuf[OSC_SUPPORT_TYPE] = support_set; - capbuf[OSC_CONTROL_TYPE] = OSC_PCI_CONTROL_MASKS; - - status = acpi_pci_run_osc(root->device->handle, capbuf, &result); + flags &= OSC_PCI_SUPPORT_MASKS; + status = acpi_pci_run_osc(root->device->handle, + root->osc_support_set | flags, + OSC_PCI_CONTROL_MASKS, + true, &result); if (ACPI_SUCCESS(status)) { - root->osc_support_set = support_set; + root->osc_support_set |= flags; root->osc_control_qry = result; root->osc_queried = 1; } @@ -373,7 +377,7 @@ EXPORT_SYMBOL_GPL(acpi_get_pci_dev); acpi_status acpi_pci_osc_control_set(acpi_handle handle, u32 flags) { acpi_status status; - u32 control_req, result, capbuf[3]; + u32 control_req, result; acpi_handle tmp; struct acpi_pci_root *root; @@ -407,10 +411,10 @@ acpi_status acpi_pci_osc_control_set(acp goto out; } - capbuf[OSC_QUERY_TYPE] = 0; - capbuf[OSC_SUPPORT_TYPE] = root->osc_support_set; - capbuf[OSC_CONTROL_TYPE] = root->osc_control_set | control_req; - status = acpi_pci_run_osc(handle, capbuf, &result); + status = acpi_pci_run_osc(handle, + root->osc_support_set, + root->osc_control_set | control_req, + false, &result); if (ACPI_SUCCESS(status)) root->osc_control_set = result; out: