From akpm@osdl.org Thu Apr 28 00:28:06 2005
Subject: [patch 09/20] acpi bridge hotadd: Remove hot-plugged devices that could not be allocated resources
To: greg@kroah.com
Cc: akpm@osdl.org, rajesh.shah@intel.com
From: akpm@osdl.org
Date: Thu, 28 Apr 2005 00:25:50 -0700


From: Rajesh Shah <rajesh.shah@intel.com>

When hot-plugging an I/O hierarchy that contains many bridges and leaf
devices, it's possible that there are not enough resources to start all the
device present.  If we fail to assign a resource, clear the corresponding
value in the pci_dev structure, so other code can take corrective action.

Signed-off-by: Rajesh Shah <rajesh.shah@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/pci/setup-bus.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletion(-)

--- gregkh-2.6.orig/drivers/pci/setup-bus.c	2005-04-06 11:47:47.000000000 -0700
+++ gregkh-2.6/drivers/pci/setup-bus.c	2005-05-03 22:28:31.000000000 -0700
@@ -72,7 +72,10 @@
 	for (list = head.next; list;) {
 		res = list->res;
 		idx = res - &list->dev->resource[0];
-		pci_assign_resource(list->dev, idx);
+		if (pci_assign_resource(list->dev, idx)) {
+			res->start = 0;
+			res->flags = 0;
+		}
 		tmp = list;
 		list = list->next;
 		kfree(tmp);