+
+struct hotplug_slot *rpaphp_find_hotplug_slot(struct pci_dev *dev)
+{
+ struct list_head *tmp, *n;
+ struct slot *slot;
+
+ list_for_each_safe(tmp, n, &rpaphp_slot_head) {
+ struct pci_bus *bus;
+ struct list_head *ln;
+
+ slot = list_entry(tmp, struct slot, rpaphp_slot_list);
+ if (slot->bridge == NULL) {
+ if (slot->dev_type == PCI_DEV) {
+ printk(KERN_WARNING "PCI slot missing bridge %s %s \n",
+ slot->name, slot->location);
+ }
+ continue;
+ }
+
+ bus = slot->bridge->subordinate;
+ if (!bus) {
+ continue; /* should never happen? */
+ }
+ for (ln = bus->devices.next; ln != &bus->devices; ln = ln->next) {
+ struct pci_dev *pdev = pci_dev_b(ln);
+ if (pdev == dev)
+ return slot->hotplug_slot;
+ }
+ }
+
+ return NULL;
+}
+
+EXPORT_SYMBOL_GPL(rpaphp_find_hotplug_slot);