]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/pci/hotplug/pciehp_core.c
PCI: pciehp: change name tag of "hpdriver_portdrv" variable
[linux-2.6-omap-h63xx.git] / drivers / pci / hotplug / pciehp_core.c
index 3677495c4f91e2bf827c7d863d431be4272c3c5a..3c8581e597c508af5a9374ea805dc0988f9f7426 100644 (file)
@@ -41,7 +41,6 @@ int pciehp_debug;
 int pciehp_poll_mode;
 int pciehp_poll_time;
 int pciehp_force;
-int pciehp_slot_with_bus;
 struct workqueue_struct *pciehp_wq;
 
 #define DRIVER_VERSION "0.4"
@@ -56,12 +55,10 @@ module_param(pciehp_debug, bool, 0644);
 module_param(pciehp_poll_mode, bool, 0644);
 module_param(pciehp_poll_time, int, 0644);
 module_param(pciehp_force, bool, 0644);
-module_param(pciehp_slot_with_bus, bool, 0644);
 MODULE_PARM_DESC(pciehp_debug, "Debugging mode enabled or not");
 MODULE_PARM_DESC(pciehp_poll_mode, "Using polling mechanism for hot-plug events or not");
 MODULE_PARM_DESC(pciehp_poll_time, "Polling mechanism frequency, in seconds");
 MODULE_PARM_DESC(pciehp_force, "Force pciehp, even if _OSC and OSHP are missing");
-MODULE_PARM_DESC(pciehp_slot_with_bus, "Use bus number in the slot name");
 
 #define PCIE_MODULE_NAME "pciehp"
 
@@ -194,6 +191,7 @@ static int init_slots(struct controller *ctrl)
        struct slot *slot;
        struct hotplug_slot *hotplug_slot;
        struct hotplug_slot_info *info;
+       int len, dup = 1;
        int retval = -ENOMEM;
 
        list_for_each_entry(slot, &ctrl->slot_list, slot_list) {
@@ -220,15 +218,24 @@ static int init_slots(struct controller *ctrl)
                dbg("Registering bus=%x dev=%x hp_slot=%x sun=%x "
                    "slot_device_offset=%x\n", slot->bus, slot->device,
                    slot->hp_slot, slot->number, ctrl->slot_device_offset);
+duplicate_name:
                retval = pci_hp_register(hotplug_slot,
                                         ctrl->pci_dev->subordinate,
                                         slot->device);
                if (retval) {
+                       /*
+                        * If slot N already exists, we'll try to create
+                        * slot N-1, N-2 ... N-M, until we overflow.
+                        */
+                       if (retval == -EEXIST) {
+                               len = snprintf(slot->name, SLOT_NAME_SIZE,
+                                              "%d-%d", slot->number, dup++);
+                               if (len < SLOT_NAME_SIZE)
+                                       goto duplicate_name;
+                               else
+                                       err("duplicate slot name overflow\n");
+                       }
                        err("pci_hp_register failed with error %d\n", retval);
-                       if (retval == -EEXIST)
-                               err("Failed to register slot because of name "
-                                   "collision. Try \'pciehp_slot_with_bus\' "
-                                   "module option.\n");
                        goto error_info;
                }
                /* create additional sysfs entries */
@@ -490,10 +497,9 @@ static struct pcie_port_service_id port_pci_ids[] = { {
        .driver_data =  0,
        }, { /* end: all zeroes */ }
 };
-static const char device_name[] = "hpdriver";
 
 static struct pcie_port_service_driver hpdriver_portdrv = {
-       .name           = (char *)device_name,
+       .name           = PCIE_MODULE_NAME,
        .id_table       = &port_pci_ids[0],
 
        .probe          = pciehp_probe,