> We could add the resources to the end of the list to maintain
> the old order if anyone cares.  Since we're using a list, the
> resources are in reverse order.

Since it makes it easier to debug in case there's a problem, here it is.

Signed-off-by: Myles Watson <myle...@gmail.com>

Thanks,
Myles
Index: svn/src/devices/device_util.c
===================================================================
--- svn.orig/src/devices/device_util.c
+++ svn/src/devices/device_util.c
@@ -339,7 +339,7 @@ struct resource *probe_resource(device_t
  */
 struct resource *new_resource(device_t dev, unsigned index)
 {
-	struct resource *resource;
+	struct resource *resource, *tail;
 
 	/* First move all of the free resources to the end */
 	compact_resources(dev);
@@ -353,8 +353,14 @@ struct resource *new_resource(device_t d
 		resource = free_resources;
 		free_resources = free_resources->next;
 		memset(resource, 0, sizeof(*resource));
-		resource->next = dev->resource_list;
-		dev->resource_list = resource;
+		resource->next = NULL;
+		tail = dev->resource_list;
+		if (tail) {
+			while (tail->next) tail = tail->next;
+			tail->next = resource;
+		}
+		else
+			dev->resource_list = resource;
 	}
 	/* Initialize the resource values */
 	if (!(resource->flags & IORESOURCE_FIXED)) {
-- 
coreboot mailing list: coreboot@coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to