aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/fakephp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/fakephp.c')
-rw-r--r--drivers/pci/hotplug/fakephp.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 146ca9cd1567..3a2637a00934 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -66,10 +66,10 @@ struct dummy_slot {
66 struct pci_dev *dev; 66 struct pci_dev *dev;
67 struct work_struct remove_work; 67 struct work_struct remove_work;
68 unsigned long removed; 68 unsigned long removed;
69 char name[8];
70}; 69};
71 70
72static int debug; 71static int debug;
72static int dup_slots;
73static LIST_HEAD(slot_list); 73static LIST_HEAD(slot_list);
74static struct workqueue_struct *dummyphp_wq; 74static struct workqueue_struct *dummyphp_wq;
75 75
@@ -96,10 +96,13 @@ static void dummy_release(struct hotplug_slot *slot)
96 kfree(dslot); 96 kfree(dslot);
97} 97}
98 98
99#define SLOT_NAME_SIZE 8
100
99static int add_slot(struct pci_dev *dev) 101static int add_slot(struct pci_dev *dev)
100{ 102{
101 struct dummy_slot *dslot; 103 struct dummy_slot *dslot;
102 struct hotplug_slot *slot; 104 struct hotplug_slot *slot;
105 char name[SLOT_NAME_SIZE];
103 int retval = -ENOMEM; 106 int retval = -ENOMEM;
104 static int count = 1; 107 static int count = 1;
105 108
@@ -119,19 +122,22 @@ static int add_slot(struct pci_dev *dev)
119 if (!dslot) 122 if (!dslot)
120 goto error_info; 123 goto error_info;
121 124
122 slot->name = dslot->name; 125 if (dup_slots)
123 snprintf(slot->name, sizeof(dslot->name), "fake%d", count++); 126 snprintf(name, SLOT_NAME_SIZE, "fake");
124 dbg("slot->name = %s\n", slot->name); 127 else
128 snprintf(name, SLOT_NAME_SIZE, "fake%d", count++);
129 dbg("slot->name = %s\n", name);
125 slot->ops = &dummy_hotplug_slot_ops; 130 slot->ops = &dummy_hotplug_slot_ops;
126 slot->release = &dummy_release; 131 slot->release = &dummy_release;
127 slot->private = dslot; 132 slot->private = dslot;
128 133
129 retval = pci_hp_register(slot, dev->bus, PCI_SLOT(dev->devfn)); 134 retval = pci_hp_register(slot, dev->bus, PCI_SLOT(dev->devfn), name);
130 if (retval) { 135 if (retval) {
131 err("pci_hp_register failed with error %d\n", retval); 136 err("pci_hp_register failed with error %d\n", retval);
132 goto error_dslot; 137 goto error_dslot;
133 } 138 }
134 139
140 dbg("slot->name = %s\n", hotplug_slot_name(slot));
135 dslot->slot = slot; 141 dslot->slot = slot;
136 dslot->dev = pci_dev_get(dev); 142 dslot->dev = pci_dev_get(dev);
137 list_add (&dslot->node, &slot_list); 143 list_add (&dslot->node, &slot_list);
@@ -167,10 +173,11 @@ static void remove_slot(struct dummy_slot *dslot)
167{ 173{
168 int retval; 174 int retval;
169 175
170 dbg("removing slot %s\n", dslot->slot->name); 176 dbg("removing slot %s\n", hotplug_slot_name(dslot->slot));
171 retval = pci_hp_deregister(dslot->slot); 177 retval = pci_hp_deregister(dslot->slot);
172 if (retval) 178 if (retval)
173 err("Problem unregistering a slot %s\n", dslot->slot->name); 179 err("Problem unregistering a slot %s\n",
180 hotplug_slot_name(dslot->slot));
174} 181}
175 182
176/* called from the single-threaded workqueue handler to remove a slot */ 183/* called from the single-threaded workqueue handler to remove a slot */
@@ -308,7 +315,7 @@ static int disable_slot(struct hotplug_slot *slot)
308 return -ENODEV; 315 return -ENODEV;
309 dslot = slot->private; 316 dslot = slot->private;
310 317
311 dbg("%s - physical_slot = %s\n", __func__, slot->name); 318 dbg("%s - physical_slot = %s\n", __func__, hotplug_slot_name(slot));
312 319
313 for (func = 7; func >= 0; func--) { 320 for (func = 7; func >= 0; func--) {
314 dev = pci_get_slot(dslot->dev->bus, dslot->dev->devfn + func); 321 dev = pci_get_slot(dslot->dev->bus, dslot->dev->devfn + func);
@@ -373,4 +380,5 @@ MODULE_DESCRIPTION(DRIVER_DESC);
373MODULE_LICENSE("GPL"); 380MODULE_LICENSE("GPL");
374module_param(debug, bool, S_IRUGO | S_IWUSR); 381module_param(debug, bool, S_IRUGO | S_IWUSR);
375MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); 382MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
376 383module_param(dup_slots, bool, S_IRUGO | S_IWUSR);
384MODULE_PARM_DESC(dup_slots, "Force duplicate slot names for debugging");