--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -997,11 +997,13 @@ static void __devinit pci_bus_slot_names(struct
device_node *node,

 static int __init of_pci_slot_init(void)
 {
-       struct pci_bus *pbus = NULL;
+       struct pci_host_bridge *host_bridge = NULL;
+       struct pci_bus *pbus;

-       while ((pbus = pci_find_next_bus(pbus)) != NULL) {
+       for_each_pci_host_bridge(host_bridge) {
                struct device_node *node;

+               pbus = hot_bridge->bus;
                if (pbus->self) {
                        /* PCI->PCI bridge */
