It doesn't make sense to me to initialize the devices in the list.  The tree
seems more appropriate.

Signed-off-by: Myles Watson <[EMAIL PROTECTED]>

Thanks,
Myles
Index: device/device.c
===================================================================
--- device/device.c	(revision 1039)
+++ device/device.c	(working copy)
@@ -1063,27 +1063,34 @@
 }
 
 /**
- * Initialize all devices in the global device list.
+ * Initialize all devices in the tree.
  *
- * Starting at the first device on the global device link list, walk the list
- * and call the device's init() method to do device specific setup.
+ * Starting at the root device, walk the tree breadth first and call the
+ * device's init() method to do device specific setup.
  */
-void dev_phase6(void)
+void dev_phase6_tree(struct device *root)
 {
 	struct device *dev;
 
-	printk(BIOS_INFO, "Phase 6: Initializing devices...\n");
-	for (dev = all_devices; dev; dev = dev->next) {
-		if (dev->enabled && dev->ops && dev->ops->phase6_init) {
-			if (dev->path.type == DEVICE_PATH_I2C) {
-				printk(BIOS_DEBUG, "Phase 6: smbus: %s[%d]->",
-				       dev_path(dev->bus->dev), dev->bus->link);
+	for (dev = root; dev; dev = dev->sibling) {
+		if (dev->enabled) {
+			if (dev->ops && dev->ops->phase6_init) {
+				if (dev->path.type == DEVICE_PATH_I2C) {
+					printk(BIOS_DEBUG, "Phase 6: smbus: %s[%d]->",
+					       dev_path(dev->bus->dev), dev->bus->link);
+				}
+				dev->ops->phase6_init(dev);
 			}
-			printk(BIOS_DEBUG, "Phase 6: %s init.\n",
-			       dev_path(dev));
-			dev->ops->phase6_init(dev);
+			if (dev->link[0].children)
+				dev_phase6_tree(dev->link[0].children);
 		}
 	}
+}
+
+void dev_phase6(void)
+{
+	printk(BIOS_INFO, "Phase 6: Initializing devices in tree...\n");
+	dev_phase6_tree(&dev_root);
 	printk(BIOS_INFO, "Phase 6: Devices initialized.\n");
 }
 
--
coreboot mailing list: [email protected]
http://www.coreboot.org/mailman/listinfo/coreboot

Reply via email to