#include <device/pci_ids.h>
#include <device/pci_ops.h>
+/*
+ * The only consumer of the return value of get_pbus() is ops_pci_bus().
+ * ops_pci_bus() can handle being passed NULL and auto-picks working ops.
+ */
static struct bus *get_pbus(device_t dev)
{
- struct bus *pbus;
+ struct bus *pbus = NULL;
if (!dev)
die("get_pbus: dev is NULL!\n");
-
- pbus = dev->bus;
+ else
+ pbus = dev->bus;
while(pbus && pbus->dev && !ops_pci_bus(pbus)) {
if (pbus == pbus->dev->bus) {
- printk_alert("%s in endless loop looking for a parent "
- "bus with ops_pci_bus for %s, breaking out\n",
+ printk(BIOS_ALERT, "%s in endless loop looking for a parent "
+ "bus with ops_pci_bus for %s, breaking out.\n",
__func__, dev_path(dev));
break;
}
pbus = pbus->dev->bus;
}
if (!pbus || !pbus->dev || !pbus->dev->ops || !pbus->dev->ops->ops_pci_bus) {
- printk_emerg("%s Cannot find pci bus operations\n", dev_path(dev));
- die("");
+ /* This can happen before the device tree is set up completely. */
+ //printk(BIOS_EMERG, "%s: Cannot find pci bus operations.\n", dev_path(dev));
+ pbus = NULL;
}
return pbus;
}