]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/pci/hotplug/rpaphp_slot.c
Merge branch 'linus' into locking/urgent, to pick up fixes
[karo-tx-linux.git] / drivers / pci / hotplug / rpaphp_slot.c
index 6937c725b00bc25fe05287367691316c756f25de..388c4d8fcdd155b6706e4dff907d50c1e32bcb9c 100644 (file)
@@ -117,8 +117,10 @@ EXPORT_SYMBOL_GPL(rpaphp_deregister_slot);
 int rpaphp_register_slot(struct slot *slot)
 {
        struct hotplug_slot *php_slot = slot->hotplug_slot;
+       struct device_node *child;
+       u32 my_index;
        int retval;
-       int slotno;
+       int slotno = -1;
 
        dbg("%s registering slot:path[%s] index[%x], name[%s] pdomain[%x] type[%d]\n",
                __func__, slot->dn->full_name, slot->index, slot->name,
@@ -130,10 +132,15 @@ int rpaphp_register_slot(struct slot *slot)
                return -EAGAIN;
        }
 
-       if (slot->dn->child)
-               slotno = PCI_SLOT(PCI_DN(slot->dn->child)->devfn);
-       else
-               slotno = -1;
+       for_each_child_of_node(slot->dn, child) {
+               retval = of_property_read_u32(child, "ibm,my-drc-index", &my_index);
+               if (my_index == slot->index) {
+                       slotno = PCI_SLOT(PCI_DN(child)->devfn);
+                       of_node_put(child);
+                       break;
+               }
+       }
+
        retval = pci_hp_register(php_slot, slot->bus, slotno, slot->name);
        if (retval) {
                err("pci_hp_register failed with error %d\n", retval);