From patchwork Tue Sep 25 08:26:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 1502941 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 C3824DF28C for ; Tue, 25 Sep 2012 08:26:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753890Ab2IYI0y (ORCPT ); Tue, 25 Sep 2012 04:26:54 -0400 Received: from acsinet15.oracle.com ([141.146.126.227]:42852 "EHLO acsinet15.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753924Ab2IYI0s (ORCPT ); Tue, 25 Sep 2012 04:26:48 -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 q8P8Qh95020216 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 25 Sep 2012 08:26:44 GMT Received: from acsmt356.oracle.com (acsmt356.oracle.com [141.146.40.156]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id q8P8Qg8g021029 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 25 Sep 2012 08:26:43 GMT Received: from abhmt113.oracle.com (abhmt113.oracle.com [141.146.116.65]) by acsmt356.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id q8P8QgSD002498; Tue, 25 Sep 2012 03:26:42 -0500 Received: from linux-siqj.site (/75.36.245.102) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 25 Sep 2012 01:26:42 -0700 From: Yinghai Lu To: Bjorn Helgaas , Len Brown Cc: linux-pci@vger.kernel.org, Yinghai Lu Subject: [PATCH 19/29] PCI: kill pci_root_buses in setup-bus Date: Tue, 25 Sep 2012 01:26:20 -0700 Message-Id: <1348561590-28067-20-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.7.7 In-Reply-To: <1348561590-28067-1-git-send-email-yinghai@kernel.org> References: <1348561590-28067-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 Signed-off-by: Yinghai Lu --- drivers/pci/setup-bus.c | 24 +++++++++++++----------- 1 files changed, 13 insertions(+), 11 deletions(-) diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 1e808ca..9737185 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c @@ -1318,12 +1318,12 @@ static int __init pci_bus_get_depth(struct pci_bus *bus) static int __init pci_get_max_depth(void) { int depth = 0; - struct pci_bus *bus; + struct pci_host_bridge *host_bridge = NULL; - list_for_each_entry(bus, &pci_root_buses, node) { + for_each_pci_host_bridge(host_bridge) { int ret; - ret = pci_bus_get_depth(bus); + ret = pci_bus_get_depth(host_bridge->bus); if (ret > depth) depth = ret; } @@ -1393,6 +1393,7 @@ void __init pci_assign_unassigned_resources(void) { struct pci_bus *bus; + struct pci_host_bridge *host_bridge = NULL; LIST_HEAD(realloc_head); /* list of resources that want additional resources */ struct list_head *add_list = NULL; @@ -1423,12 +1424,13 @@ again: add_list = &realloc_head; /* Depth first, calculate sizes and alignments of all subordinate buses. */ - list_for_each_entry(bus, &pci_root_buses, node) - __pci_bus_size_bridges(bus, add_list); + for_each_pci_host_bridge(host_bridge) + __pci_bus_size_bridges(host_bridge->bus, add_list); /* Depth last, allocate resources and update the hardware. */ - list_for_each_entry(bus, &pci_root_buses, node) - __pci_bus_assign_resources(bus, add_list, &fail_head); + for_each_pci_host_bridge(host_bridge) + __pci_bus_assign_resources(host_bridge->bus, add_list, + &fail_head); if (add_list) BUG_ON(!list_empty(add_list)); tried_times++; @@ -1480,12 +1482,12 @@ again: enable_and_dump: /* Depth last, update the hardware. */ - list_for_each_entry(bus, &pci_root_buses, node) - pci_enable_bridges(bus); + for_each_pci_host_bridge(host_bridge) + pci_enable_bridges(host_bridge->bus); /* dump the resource on buses */ - list_for_each_entry(bus, &pci_root_buses, node) - pci_bus_dump_resources(bus); + for_each_pci_host_bridge(host_bridge) + pci_bus_dump_resources(host_bridge->bus); } void pci_assign_unassigned_bridge_resources(struct pci_dev *bridge)