]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pci/hotplug/pci_hotplug_core.c
PCI: ACPI PCI slot detection driver
[linux-2.6-omap-h63xx.git] / drivers / pci / hotplug / pci_hotplug_core.c
index 4df31f375197a0466b4523a24cd305f054429fc5..b3b2d8cf43701722029307c8c3d9b89f832f7b5f 100644 (file)
@@ -572,6 +572,11 @@ int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr)
        if (tmp)
                return -EEXIST;
 
+       /*
+        * No problems if we call this interface from both ACPI_PCI_SLOT
+        * driver and call it here again. If we've already created the
+        * pci_slot, the interface will simply bump the refcount.
+        */
        pci_slot = pci_create_slot(bus, slot_nr, slot->name);
        if (IS_ERR(pci_slot))
                return PTR_ERR(pci_slot);
@@ -585,6 +590,17 @@ int pci_hp_register(struct hotplug_slot *slot, struct pci_bus *bus, int slot_nr)
        slot->pci_slot = pci_slot;
        pci_slot->hotplug = slot;
 
+       /*
+        * Allow pcihp drivers to override the ACPI_PCI_SLOT name.
+        */
+       if (strcmp(kobject_name(&pci_slot->kobj), slot->name)) {
+               result = kobject_rename(&pci_slot->kobj, slot->name);
+               if (result) {
+                       pci_destroy_slot(pci_slot);
+                       return result;
+               }
+       }
+
        spin_lock(&pci_hotplug_slot_list_lock);
        list_add(&slot->slot_list, &pci_hotplug_slot_list);
        spin_unlock(&pci_hotplug_slot_list_lock);