From patchwork Tue Oct 2 06:33:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 1535751 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id F3254DF238 for ; Tue, 2 Oct 2012 06:33:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754068Ab2JBGdO (ORCPT ); Tue, 2 Oct 2012 02:33:14 -0400 Received: from acsinet15.oracle.com ([141.146.126.227]:31292 "EHLO acsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753382Ab2JBGdM (ORCPT ); Tue, 2 Oct 2012 02:33:12 -0400 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q926X7X5013018 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 2 Oct 2012 06:33:08 GMT Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q926X6XV000537 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 2 Oct 2012 06:33:07 GMT Received: from abhmt111.oracle.com (abhmt111.oracle.com [141.146.116.63]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q926X6uT011002; Tue, 2 Oct 2012 01:33:06 -0500 Received: from linux-siqj.site (/75.36.244.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 01 Oct 2012 23:33:06 -0700 From: Yinghai Lu To: Bjorn Helgaas Cc: linux-pci@vger.kernel.org, Yinghai Lu , linux-acpi@vger.kernel.org Subject: [PATCH 06/10] PCI, ACPI: Move hot add root bus conf code to acpi_pci_root_add Date: Mon, 1 Oct 2012 23:33:04 -0700 Message-Id: <1349159588-15029-7-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1349159588-15029-1-git-send-email-yinghai@kernel.org> References: <1349159588-15029-1-git-send-email-yinghai@kernel.org> X-Source-IP: ucsinet21.oracle.com [156.151.31.93] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org It is safe before we really put those pci devices in the tree. Signed-off-by: Yinghai Lu Cc:Len Brown Cc: linux-acpi@vger.kernel.org --- drivers/acpi/pci_root.c | 31 ++++++++++++++++--------------- 1 files changed, 16 insertions(+), 15 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 75643ce..e63a58d 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -506,6 +506,7 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) acpi_status status; int result; struct acpi_pci_root *root; + struct acpi_pci_driver *driver; acpi_handle handle; u32 flags; @@ -607,6 +608,21 @@ static int __devinit acpi_pci_root_add(struct acpi_device *device) if (device->wakeup.flags.run_wake) device_set_run_wake(root->bus->bridge, true); + if (system_state != SYSTEM_BOOTING) { + pcibios_resource_survey_bus(root->bus); + pci_assign_unassigned_bus_resources(root->bus); + } + + mutex_lock(&acpi_pci_root_lock); + list_for_each_entry(driver, &acpi_pci_drivers, node) + if (driver->add) + driver->add(root); + mutex_unlock(&acpi_pci_root_lock); + + /* need to after hot-added ioapic is registered */ + if (system_state != SYSTEM_BOOTING) + pci_enable_bridges(root->bus); + return 0; out_del_root: @@ -621,22 +637,7 @@ end: static int acpi_pci_root_start(struct acpi_device *device) { struct acpi_pci_root *root = acpi_driver_data(device); - struct acpi_pci_driver *driver; - - if (system_state != SYSTEM_BOOTING) { - pcibios_resource_survey_bus(root->bus); - pci_assign_unassigned_bus_resources(root->bus); - } - mutex_lock(&acpi_pci_root_lock); - list_for_each_entry(driver, &acpi_pci_drivers, node) - if (driver->add) - driver->add(root); - mutex_unlock(&acpi_pci_root_lock); - - /* need to after hot-added ioapic is registered */ - if (system_state != SYSTEM_BOOTING) - pci_enable_bridges(root->bus); pci_bus_add_devices(root->bus);