From patchwork Sun Sep 2 21:54:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 1397541 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 DBE3F3FC71 for ; Sun, 2 Sep 2012 21:55:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755853Ab2IBVzY (ORCPT ); Sun, 2 Sep 2012 17:55:24 -0400 Received: from acsinet15.oracle.com ([141.146.126.227]:20055 "EHLO acsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755979Ab2IBVyt (ORCPT ); Sun, 2 Sep 2012 17:54:49 -0400 Received: from acsinet22.oracle.com (acsinet22.oracle.com [141.146.126.238]) by acsinet15.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id q82LsTtX005789 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 2 Sep 2012 21:54:30 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by acsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q82LsTWC014451 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 2 Sep 2012 21:54:29 GMT Received: from abhmt111.oracle.com (abhmt111.oracle.com [141.146.116.63]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q82LsTeL001017; Sun, 2 Sep 2012 16:54:29 -0500 Received: from linux-siqj.site (/75.55.221.75) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 02 Sep 2012 14:54:28 -0700 From: Yinghai Lu To: Bjorn Helgaas , 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 , Len Brown Subject: [PATCH part4 06/11] PCI, ACPI: Make acpi_pci_root_remove remove pci root bus too Date: Sun, 2 Sep 2012 14:54:16 -0700 Message-Id: <1346622861-30865-7-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1346622861-30865-1-git-send-email-yinghai@kernel.org> References: <1346622861-30865-1-git-send-email-yinghai@kernel.org> X-Source-IP: acsinet22.oracle.com [141.146.126.238] 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 | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index ec54014..12791fd 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -645,10 +645,24 @@ 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; + } + 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_stop_and_remove_bus(root->bus); + +out: + list_del(&root->node); kfree(root); + return 0; }