Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

shpchp: fix slot name

Current shpchp uses the combination of bus number and slot number as a
slot name. But it is not a good idea because bus number is not a
physical identifier but a logical identifier. This is against the shpc
specification. So remove the bus number from the physical identifier.

However, there are some platforms with the problem that it provides
the same slot number. For those platforms, this patch also introduces
new module option 'shpchp_slot_with_bus'. If it is specified, shpchp
uses the combination of bus number and slot number as a slot name.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>

authored by

Kenji Kaneshige and committed by
Jesse Barnes
ef0ff95f 4ea3e58b

+9 -2
+9 -2
drivers/pci/hotplug/shpchp_core.c
··· 39 39 int shpchp_debug; 40 40 int shpchp_poll_mode; 41 41 int shpchp_poll_time; 42 + int shpchp_slot_with_bus; 42 43 struct workqueue_struct *shpchp_wq; 43 44 44 45 #define DRIVER_VERSION "0.4" ··· 53 52 module_param(shpchp_debug, bool, 0644); 54 53 module_param(shpchp_poll_mode, bool, 0644); 55 54 module_param(shpchp_poll_time, int, 0644); 55 + module_param(shpchp_slot_with_bus, bool, 0644); 56 56 MODULE_PARM_DESC(shpchp_debug, "Debugging mode enabled or not"); 57 57 MODULE_PARM_DESC(shpchp_poll_mode, "Using polling mechanism for hot-plug events or not"); 58 58 MODULE_PARM_DESC(shpchp_poll_time, "Polling mechanism frequency, in seconds"); 59 + MODULE_PARM_DESC(shpchp_slot_with_bus, "Use bus number in the slot name"); 59 60 60 61 #define SHPC_MODULE_NAME "shpchp" 61 62 ··· 103 100 104 101 static void make_slot_name(struct slot *slot) 105 102 { 106 - snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%04d_%04d", 107 - slot->bus, slot->number); 103 + if (shpchp_slot_with_bus) 104 + snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%04d_%04d", 105 + slot->bus, slot->number); 106 + else 107 + snprintf(slot->hotplug_slot->name, SLOT_NAME_SIZE, "%d", 108 + slot->number); 108 109 } 109 110 110 111 static int init_slots(struct controller *ctrl)