linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yinghai Lu <yinghai@kernel.org>
To: Bjorn Helgaas <bhelgaas@google.com>, Len Brown <lenb@kernel.org>
Cc: linux-pci@vger.kernel.org, Yinghai Lu <yinghai@kernel.org>,
	David Howells <dhowells@redhat.com>,
	Koichi Yasutake <yasutake.koichi@jp.panasonic.com>,
	linux-am33-list@redhat.com
Subject: [PATCH 26/29] PCI, mn10300: kill pci_root_buses in resources reservations
Date: Tue, 25 Sep 2012 01:26:27 -0700	[thread overview]
Message-ID: <1348561590-28067-27-git-send-email-yinghai@kernel.org> (raw)
In-Reply-To: <1348561590-28067-1-git-send-email-yinghai@kernel.org>

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Koichi Yasutake <yasutake.koichi@jp.panasonic.com>
Cc: linux-am33-list@redhat.com
---
 arch/mn10300/unit-asb2305/pci-asb2305.c |   62 ++++++++++++++++--------------
 1 files changed, 33 insertions(+), 29 deletions(-)

diff --git a/arch/mn10300/unit-asb2305/pci-asb2305.c b/arch/mn10300/unit-asb2305/pci-asb2305.c
index c4e2e79..87c945d 100644
--- a/arch/mn10300/unit-asb2305/pci-asb2305.c
+++ b/arch/mn10300/unit-asb2305/pci-asb2305.c
@@ -88,42 +88,42 @@ resource_size_t pcibios_align_resource(void *data, const struct resource *res,
  *	    requested by the user, configure expansion ROM address
  *	    as well.
  */
-static void __init pcibios_allocate_bus_resources(struct list_head *bus_list)
+static void __init pcibios_allocate_bridge_resources(struct pci_dev *dev)
 {
-	struct pci_bus *bus;
-	struct pci_dev *dev;
 	int idx;
 	struct resource *r;
 
-	/* Depth-First Search on bus tree */
-	list_for_each_entry(bus, bus_list, node) {
-		dev = bus->self;
-		if (dev) {
-			for (idx = PCI_BRIDGE_RESOURCES;
-			     idx < PCI_NUM_RESOURCES;
-			     idx++) {
-				r = &dev->resource[idx];
-				if (!r->flags)
-					continue;
-				if (!r->start ||
-				    pci_claim_resource(dev, idx) < 0) {
-					printk(KERN_ERR "PCI:"
-					       " Cannot allocate resource"
-					       " region %d of bridge %s\n",
-					       idx, pci_name(dev));
-					/* Something is wrong with the region.
-					 * Invalidate the resource to prevent
-					 * child resource allocations in this
-					 * range. */
-					r->start = r->end = 0;
-					r->flags = 0;
-				}
-			}
+	for (idx = PCI_BRIDGE_RESOURCES;
+	     idx < PCI_NUM_RESOURCES;
+	     idx++) {
+		r = &dev->resource[idx];
+		if (!r->flags)
+			continue;
+		if (!r->start ||
+		    pci_claim_resource(dev, idx) < 0) {
+			pr_err("PCI: Cannot allocate resource region %d of bridge %s\n",
+			       idx, pci_name(dev));
+			/* Something is wrong with the region.
+			 * Invalidate the resource to prevent
+			 * child resource allocations in this
+			 * range. */
+			r->start = r->end = 0;
+			r->flags = 0;
 		}
-		pcibios_allocate_bus_resources(&bus->children);
 	}
 }
 
+static void pcibios_allocate_bus_resources(struct pci_bus *bus)
+{
+	struct pci_bus *child;
+
+	/* Depth-First Search on bus tree */
+	if (bus->self)
+		pcibios_allocate_bridge_resources(bus->self);
+	list_for_each_entry(child, &bus->children, node)
+		pcibios_allocate_bus_resources(child);
+}
+
 static void __init pcibios_allocate_resources(int pass)
 {
 	struct pci_dev *dev = NULL;
@@ -207,8 +207,12 @@ fs_initcall(pcibios_assign_resources);
 
 void __init pcibios_resource_survey(void)
 {
+	struct pci_host_bridge *host_bridge = NULL;
+
 	DBG("PCI: Allocating resources\n");
-	pcibios_allocate_bus_resources(&pci_root_buses);
+
+	for_each_pci_host_bridge(host_bridge)
+		pcibios_allocate_bus_resources(host_bridge->bus);
 	pcibios_allocate_resources(0);
 	pcibios_allocate_resources(1);
 }
-- 
1.7.7


  parent reply	other threads:[~2012-09-25  8:26 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-25  8:26 [PATCH 00/29] PCI: use pci host bridge to loop pci root bus Yinghai Lu
2012-09-25  8:26 ` [PATCH 01/29] PCI, x86: Separate out pcibios_allocate_bridge_resources() Yinghai Lu
2012-09-25  8:26 ` [PATCH 02/29] PCI. x86: Separate out pcibios_allocate_dev_resources() Yinghai Lu
2012-09-25  8:26 ` [PATCH 03/29] PCI, x86: Let pcibios_allocate_bus_resources() take bus instead Yinghai Lu
2012-09-25  8:26 ` [PATCH 04/29] PCI, x86: Separate out rom resource claim Yinghai Lu
2012-09-25  8:26 ` [PATCH 05/29] PCI: rename pci_release_bus_bridge_dev to pci_release_host_bridge_dev Yinghai Lu
2012-09-25  8:26 ` [PATCH 06/29] PCI: Add dummy bus_type for pci_host_bridge Yinghai Lu
2012-09-25  8:26 ` [PATCH 07/29] PCI, ACPI: add acpi_bus_type for host bridge Yinghai Lu
2012-09-25  8:26 ` [PATCH 08/29] PCI, ACPI: Remove acpi_find_bridge_device for acpi_bus_type Yinghai Lu
2012-09-25  8:26 ` [PATCH 09/29] PCI, libata: remove find_bridge in acpi_bus_type Yinghai Lu
2012-09-25 16:23   ` Jeff Garzik
2012-09-25  8:26 ` [PATCH 10/29] PCI, USB: " Yinghai Lu
2012-09-25  8:35   ` Lan Tianyu
2012-09-25 16:57     ` Yinghai Lu
2012-09-27 20:21       ` Yinghai Lu
2012-09-28  5:48         ` Lan Tianyu
2012-09-25  8:26 ` [PATCH 11/29] PCI, ACPI: " Yinghai Lu
2012-09-25  8:26 ` [PATCH 12/29] PCI: Add for_each_pci_host_bridge() and pci_get_next_host_bridge Yinghai Lu
2012-09-25 14:51   ` Jiang Liu
2012-09-25 14:59     ` Yinghai Lu
2012-09-25 15:04   ` Jiang Liu
2012-09-25 15:56   ` [PATCH] " Jiang Liu
2012-09-25 16:25     ` Yinghai Lu
2012-09-25  8:26 ` [PATCH 13/29] PCI, hotplug: kill pci_find_next_bus n sgi_hotplug Yinghai Lu
2012-09-25  8:26 ` [PATCH 14/29] PCI: kill pci_find_next_bus in pci_sysfs Yinghai Lu
2012-09-25  8:26 ` [PATCH 15/29] PCI, edac: kill pci_find_next_bus in edac Yinghai Lu
2012-09-25  9:20   ` Mauro Carvalho Chehab
2012-09-25  8:26 ` [PATCH 16/29] PCI, x86: kill pci_find_next_bus in pcibios_scan_root Yinghai Lu
2012-09-25  8:26 ` [PATCH 17/29] PCI, x86: kill pci_root_buses in resources reservations Yinghai Lu
2012-09-25  8:26 ` [PATCH 18/29] PCI, drm: kill pci_root_buses in alpha hose setting Yinghai Lu
2012-09-25  8:26 ` [PATCH 19/29] PCI: kill pci_root_buses in setup-bus Yinghai Lu
2012-09-25  8:26 ` [PATCH 20/29] PCI, sparc: kill pci_find_next_bus Yinghai Lu
2012-09-25  8:40   ` Jurij Smakov
2012-09-25 16:33     ` Yinghai Lu
2012-09-25 17:05   ` David Miller
2012-09-25  8:26 ` [PATCH 21/29] PCI, ia64: " Yinghai Lu
2012-09-25  8:26 ` [PATCH 22/29] PCI, alpha: kill pci_root_buses Yinghai Lu
2012-09-25  8:26 ` [PATCH 23/29] PCI, arm: " Yinghai Lu
2012-09-25  8:26 ` [PATCH 24/29] PCI, frv: kill pci_root_buses in resources reservations Yinghai Lu
2012-09-25  8:26 ` [PATCH 25/29] PCI, microblaze: " Yinghai Lu
2012-09-25  8:26 ` Yinghai Lu [this message]
2012-09-25  8:26 ` [PATCH 27/29] PCI, powerpc: " Yinghai Lu
2012-09-25  8:26 ` [PATCH 28/29] PCI: kill pci_find_next_bus Yinghai Lu
2012-09-25  8:26 ` [PATCH 29/29] PCI: kill pci_root_buses Yinghai Lu
2012-09-25 16:23 ` [PATCH 00/29] PCI: use pci host bridge to loop pci root bus Bjorn Helgaas
2012-09-25 16:29   ` Yinghai Lu
2012-09-25 17:37     ` Bjorn Helgaas
2012-09-25 18:06       ` Yinghai Lu
2012-09-25 18:19         ` Bjorn Helgaas
2012-09-25 19:17           ` Yinghai Lu
2012-09-25 19:45             ` Bjorn Helgaas
2012-09-25 19:53               ` Yinghai Lu
2012-09-25 20:06                 ` Bjorn Helgaas
2012-09-25 22:44                   ` Yinghai Lu
2012-09-25 19:38 ` Yinghai Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1348561590-28067-27-git-send-email-yinghai@kernel.org \
    --to=yinghai@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=dhowells@redhat.com \
    --cc=lenb@kernel.org \
    --cc=linux-am33-list@redhat.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=yasutake.koichi@jp.panasonic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).