From patchwork Wed Sep 19 18:54:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 1479251 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 200CC3FE79 for ; Wed, 19 Sep 2012 18:57:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757071Ab2ISSzl (ORCPT ); Wed, 19 Sep 2012 14:55:41 -0400 Received: from acsinet15.oracle.com ([141.146.126.227]:48057 "EHLO acsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757014Ab2ISSzd (ORCPT ); Wed, 19 Sep 2012 14:55:33 -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 q8JItK40029802 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 19 Sep 2012 18:55:21 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q8JItJTO012443 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Wed, 19 Sep 2012 18:55:19 GMT Received: from abhmt109.oracle.com (abhmt109.oracle.com [141.146.116.61]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q8JItJqU029927; Wed, 19 Sep 2012 13:55:19 -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:18 -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 25/40] PCI, ACPI: Make acpi_pci_root_remove remove pci root bus too Date: Wed, 19 Sep 2012 11:54:39 -0700 Message-Id: <1348080894-23412-26-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 It will call new added pci_stop_and_remove_bus() to stop/remove pci root bus. Also checking if that pci_root_bus get removed already in bus remove in /sys Signed-off-by: Yinghai Lu Cc: Len Brown Cc: linux-acpi@vger.kernel.org --- drivers/acpi/pci_root.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 3d92c0e..92ec5c9 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -652,10 +652,26 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type) { struct acpi_pci_root *root = acpi_driver_data(device); + /* that root bus could be removed already */ + if (!pci_find_bus(root->segment, root->secondary.start)) { + dev_printk(KERN_DEBUG, &device->dev, + "freeing acpi_pci_root, but pci root bus was removed before"); + goto out; + } + + pci_stop_root_bus(root->bus); + device_set_run_wake(root->bus->bridge, false); pci_acpi_remove_bus_pm_notifier(device); + dev_printk(KERN_DEBUG, &device->dev, + "freeing acpi_pci_root, will remove pci root bus at first"); + pci_remove_root_bus(root->bus); + +out: + list_del(&root->node); kfree(root); + return 0; }