From patchwork Tue Sep 18 06:23:23 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taku Izumi X-Patchwork-Id: 184620 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id C31942C008A for ; Tue, 18 Sep 2012 16:23:17 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756862Ab2IRGXQ (ORCPT ); Tue, 18 Sep 2012 02:23:16 -0400 Received: from fgwmail5.fujitsu.co.jp ([192.51.44.35]:53634 "EHLO fgwmail5.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755817Ab2IRGXP (ORCPT ); Tue, 18 Sep 2012 02:23:15 -0400 Received: from m2.gw.fujitsu.co.jp (unknown [10.0.50.72]) by fgwmail5.fujitsu.co.jp (Postfix) with ESMTP id AB8133EE0BC; Tue, 18 Sep 2012 15:23:14 +0900 (JST) Received: from smail (m2 [127.0.0.1]) by outgoing.m2.gw.fujitsu.co.jp (Postfix) with ESMTP id 91D5845DE53; Tue, 18 Sep 2012 15:23:14 +0900 (JST) Received: from s2.gw.fujitsu.co.jp (s2.gw.fujitsu.co.jp [10.0.50.92]) by m2.gw.fujitsu.co.jp (Postfix) with ESMTP id 70A4B45DE4D; Tue, 18 Sep 2012 15:23:14 +0900 (JST) Received: from s2.gw.fujitsu.co.jp (localhost.localdomain [127.0.0.1]) by s2.gw.fujitsu.co.jp (Postfix) with ESMTP id 5FEAC1DB803F; Tue, 18 Sep 2012 15:23:14 +0900 (JST) Received: from m003.s.css.fujitsu.com (m003.s.css.fujitsu.com [10.23.4.33]) by s2.gw.fujitsu.co.jp (Postfix) with ESMTP id 1CA7E1DB803A; Tue, 18 Sep 2012 15:23:14 +0900 (JST) Received: from m003.css.fujitsu.com (m003 [127.0.0.1]) by m003.s.css.fujitsu.com (Postfix) with ESMTP id EE68150EC38; Tue, 18 Sep 2012 15:23:13 +0900 (JST) Received: from DEUCALION (unknown [10.124.101.32]) by m003.s.css.fujitsu.com (Postfix) with SMTP id BDAF550EC25; Tue, 18 Sep 2012 15:23:13 +0900 (JST) X-SecurityPolicyCheck: OK by SHieldMailChecker v1.7.4 Date: Tue, 18 Sep 2012 15:23:23 +0900 From: Taku Izumi To: linux-pci@vger.kernel.org, bhelgaas@google.com Cc: linux-acpi@vger.kernel.org, kaneshige.kenji@jp.fujitsu.com, yinghai@kernel.org, jiang.liu@huawei.com Subject: [PATCH v3 5/8] ACPI, PCI: change acpi_pci_find_root implementation Message-Id: <20120918152323.48cb2703.izumi.taku@jp.fujitsu.com> In-Reply-To: <20120918151215.59ea763b.izumi.taku@jp.fujitsu.com> References: <20120918151215.59ea763b.izumi.taku@jp.fujitsu.com> X-Mailer: Sylpheed 3.1.1 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org This patch changes the implementation of acpi_pci_find_root(). We can access acpi_pci_root without scanning acpi_pci_roots list. If hostbridge hotplug is supported, acpi_pci_roots list will be protected by mutex. We should not access acpi_pci_roots list if preventable to lessen deadlock risk. Signed-off-by: Taku Izumi --- drivers/acpi/pci_root.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: Bjorn-next-0903/drivers/acpi/pci_root.c =================================================================== --- Bjorn-next-0903.orig/drivers/acpi/pci_root.c +++ Bjorn-next-0903/drivers/acpi/pci_root.c @@ -265,12 +265,15 @@ static acpi_status acpi_pci_osc_support( struct acpi_pci_root *acpi_pci_find_root(acpi_handle handle) { struct acpi_pci_root *root; + struct acpi_device *device; - list_for_each_entry(root, &acpi_pci_roots, node) { - if (root->device->handle == handle) - return root; - } - return NULL; + if (acpi_bus_get_device(handle, &device) || + acpi_match_device_ids(device, root_device_ids)) + return NULL; + + root = acpi_driver_data(device); + + return root; } EXPORT_SYMBOL_GPL(acpi_pci_find_root);