提交 0b8b0dca 编写于 作者: A Alex Chiang 提交者: Jesse Barnes

PCI Hotplug: fakephp: add duplicate slot name debugging

The PCI core now manages slot names on behalf of slot detection
and slot hotplug drivers, including the handling of duplicate
slot names.

We can use the fakephp driver to help test the new functionality.
Add a 'dup_slots' module param to force fakephp to create multiple
slots with the same name. We can then verify that the PCI core
correctly renamed the slots.

	sapphire:/sys/bus/pci/slots # modprobe fakephp dup_slots
	sapphire:/sys/bus/pci/slots # ls
	fake    fake-10  fake-3  fake-5  fake-7  fake-9
	fake-1  fake-2   fake-4  fake-6  fake-8

Cc: kristen.c.accardi@intel.com
Cc: matthew@wil.cx
Acked-by: NKenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: NAlex Chiang <achiang@hp.com>
Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
上级 58319b80
...@@ -69,6 +69,7 @@ struct dummy_slot { ...@@ -69,6 +69,7 @@ struct dummy_slot {
}; };
static int debug; static int debug;
static int dup_slots;
static LIST_HEAD(slot_list); static LIST_HEAD(slot_list);
static struct workqueue_struct *dummyphp_wq; static struct workqueue_struct *dummyphp_wq;
...@@ -121,7 +122,11 @@ static int add_slot(struct pci_dev *dev) ...@@ -121,7 +122,11 @@ static int add_slot(struct pci_dev *dev)
if (!dslot) if (!dslot)
goto error_info; goto error_info;
if (dup_slots)
snprintf(name, SLOT_NAME_SIZE, "fake");
else
snprintf(name, SLOT_NAME_SIZE, "fake%d", count++); snprintf(name, SLOT_NAME_SIZE, "fake%d", count++);
dbg("slot->name = %s\n", name);
slot->ops = &dummy_hotplug_slot_ops; slot->ops = &dummy_hotplug_slot_ops;
slot->release = &dummy_release; slot->release = &dummy_release;
slot->private = dslot; slot->private = dslot;
...@@ -375,4 +380,5 @@ MODULE_DESCRIPTION(DRIVER_DESC); ...@@ -375,4 +380,5 @@ MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
module_param(debug, bool, S_IRUGO | S_IWUSR); module_param(debug, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(debug, "Debugging mode enabled or not"); MODULE_PARM_DESC(debug, "Debugging mode enabled or not");
module_param(dup_slots, bool, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(dup_slots, "Force duplicate slot names for debugging");
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册