From patchwork Sun Jan 27 05:36:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 215968 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id E58362C01BB for ; Sun, 27 Jan 2013 16:39:20 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755928Ab3A0FjU (ORCPT ); Sun, 27 Jan 2013 00:39:20 -0500 Received: from aserp1040.oracle.com ([141.146.126.69]:37807 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755825Ab3A0FjT (ORCPT ); Sun, 27 Jan 2013 00:39:19 -0500 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r0R5cV0B025281 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 27 Jan 2013 05:38:32 GMT Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r0R5cTHu004803 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 27 Jan 2013 05:38:29 GMT Received: from abhmt114.oracle.com (abhmt114.oracle.com [141.146.116.66]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id r0R5cRSd028210; Sat, 26 Jan 2013 23:38:28 -0600 Received: from linux-siqj.site (/75.36.253.103) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 26 Jan 2013 21:38:27 -0800 From: Yinghai Lu To: Bjorn Helgaas , Jiang Liu , "Rafael J. Wysocki" , Taku Izumi Cc: linux-pci@vger.kernel.org, Yinghai Lu , Benjamin Herrenschmidt , Paul Mackerras , linuxppc-dev@lists.ozlabs.org Subject: [PATCH v2 20/22] PCI, powerpc: Kill pci_root_buses in resources reservations Date: Sat, 26 Jan 2013 21:36:41 -0800 Message-Id: <1359265003-16166-21-git-send-email-yinghai@kernel.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359265003-16166-1-git-send-email-yinghai@kernel.org> References: <1359265003-16166-1-git-send-email-yinghai@kernel.org> X-Source-IP: ucsinet22.oracle.com [156.151.31.94] Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Signed-off-by: Yinghai Lu Cc: Benjamin Herrenschmidt Cc: Paul Mackerras Cc: linuxppc-dev@lists.ozlabs.org --- arch/powerpc/kernel/pci-common.c | 13 ++++++------- arch/powerpc/kernel/pci_64.c | 8 ++++---- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index abc0d08..9ccecbe 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c @@ -1398,11 +1398,11 @@ static void __init pcibios_reserve_legacy_regions(struct pci_bus *bus) void __init pcibios_resource_survey(void) { - struct pci_bus *b; + struct pci_host_bridge *host_bridge = NULL; /* Allocate and assign resources */ - list_for_each_entry(b, &pci_root_buses, node) - pcibios_allocate_bus_resources(b); + for_each_pci_host_bridge(host_bridge) + pcibios_allocate_bus_resources(host_bridge->bus); pcibios_allocate_resources(0); pcibios_allocate_resources(1); @@ -1410,10 +1410,9 @@ void __init pcibios_resource_survey(void) * the low IO area and the VGA memory area if they intersect the * bus available resources to avoid allocating things on top of them */ - if (!pci_has_flag(PCI_PROBE_ONLY)) { - list_for_each_entry(b, &pci_root_buses, node) - pcibios_reserve_legacy_regions(b); - } + if (!pci_has_flag(PCI_PROBE_ONLY)) + for_each_pci_host_bridge(host_bridge) + pcibios_reserve_legacy_regions(host_bridge->bus); /* Now, if the platform didn't decide to blindly trust the firmware, * we proceed to assigning things that were left unassigned diff --git a/arch/powerpc/kernel/pci_64.c b/arch/powerpc/kernel/pci_64.c index 2cbe676..f848325 100644 --- a/arch/powerpc/kernel/pci_64.c +++ b/arch/powerpc/kernel/pci_64.c @@ -208,9 +208,9 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus, unsigned long in_devfn) { struct pci_controller* hose; - struct list_head *ln; - struct pci_bus *bus = NULL; + struct pci_bus *bus; struct device_node *hose_node; + struct pci_host_bridge *host_bridge = NULL; /* Argh ! Please forgive me for that hack, but that's the * simplest way to get existing XFree to not lockup on some @@ -230,8 +230,8 @@ long sys_pciconfig_iobase(long which, unsigned long in_bus, * used on pre-domains setup. We return the first match */ - for (ln = pci_root_buses.next; ln != &pci_root_buses; ln = ln->next) { - bus = pci_bus_b(ln); + for_each_pci_host_bridge(host_bridge) { + bus = host_bridge->bus; if (in_bus >= bus->number && in_bus <= bus->busn_res.end) break; bus = NULL;