From patchwork Wed Sep 19 18:54:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 1479151 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: patchwork-linux-pci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 48E6A3FE79 for ; Wed, 19 Sep 2012 18:57:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932907Ab2ISSzs (ORCPT ); Wed, 19 Sep 2012 14:55:48 -0400 Received: from rcsinet15.oracle.com ([148.87.113.117]:19796 "EHLO rcsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757028Ab2ISSzl (ORCPT ); Wed, 19 Sep 2012 14:55:41 -0400 Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by rcsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q8JItTA9024199 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Sep 2012 18:55:29 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 q8JItRE9012686 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 19 Sep 2012 18:55:27 GMT Received: from abhmt109.oracle.com (abhmt109.oracle.com [141.146.116.61]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q8JItQVa016557; Wed, 19 Sep 2012 13:55:27 -0500 Received: from linux-siqj.site (/10.132.126.191) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 19 Sep 2012 11:55:26 -0700 From: Yinghai Lu To: Bjorn Helgaas , Len Brown , Taku Izumi , Jiang Liu , x86 Cc: Andrew Morton , Linus Torvalds , Greg Kroah-Hartman , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, Yinghai Lu Subject: [PATCH 34/40] ACPI, PCI: Notify acpi_pci_drivers when hot-plugging PCI root bridges Date: Wed, 19 Sep 2012 11:54:48 -0700 Message-Id: <1348080894-23412-35-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1348080894-23412-1-git-send-email-yinghai@kernel.org> References: <1348080894-23412-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 From: Jiang Liu When hot-plugging PCI root bridge, acpi_pci_drivers' add()/remove() methods should be invoked to notify registered drivers. -v2: Move add calling to acpi_pci_root_start - Yinghai -v3: use acpi_pci_root pointer instead of handle - Yinghai -v3: Fold stop ioapic/iommu drivers after pci devices change in. - Yinghai Signed-off-by: Jiang Liu Signed-off-by: Yinghai Lu --- drivers/acpi/pci_root.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 325cf5c..0ea5ad0 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -633,6 +633,11 @@ 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; + + list_for_each_entry(driver, &acpi_pci_drivers, node) + if (driver->add) + driver->add(root); pci_bus_add_devices(root->bus); return 0; @@ -643,6 +648,7 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type) acpi_status status; acpi_handle handle; struct acpi_pci_root *root = acpi_driver_data(device); + struct acpi_pci_driver *driver; /* that root bus could be removed already */ if (!pci_find_bus(root->segment, root->secondary.start)) { @@ -651,8 +657,13 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type) goto out; } + /* stop normal pci drivers before we stop ioapic and dmar etc */ pci_stop_root_bus(root->bus); + list_for_each_entry_reverse(driver, &acpi_pci_drivers, node) + if (driver->remove) + driver->remove(root); + device_set_run_wake(root->bus->bridge, false); pci_acpi_remove_bus_pm_notifier(device);