[PATCH v5 16/16] PCI Hotplug: fakephp: add duplicate slot name debugging

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Alex Chiang
Date: Wednesday, October 8, 2008 - 9:47 pm

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: jbarnes@virtuousgeek.org
Cc: kristen.c.accardi@intel.com
Cc: matthew@wil.cx
Cc: kaneshige.kenji@jp.fujitsu.com
Signed-off-by: Alex Chiang <achiang@hp.com>
---

 drivers/pci/hotplug/fakephp.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c
index 24dcbf1..3a2637a 100644
--- a/drivers/pci/hotplug/fakephp.c
+++ b/drivers/pci/hotplug/fakephp.c
@@ -69,6 +69,7 @@ struct dummy_slot {
 };
 
 static int debug;
+static int dup_slots;
 static LIST_HEAD(slot_list);
 static struct workqueue_struct *dummyphp_wq;
 
@@ -121,7 +122,11 @@ static int add_slot(struct pci_dev *dev)
 	if (!dslot)
 		goto error_info;
 
-	snprintf(name, SLOT_NAME_SIZE, "fake%d", count++);
+	if (dup_slots)
+		snprintf(name, SLOT_NAME_SIZE, "fake");
+	else
+		snprintf(name, SLOT_NAME_SIZE, "fake%d", count++);
+	dbg("slot->name = %s\n", name);
 	slot->ops = &dummy_hotplug_slot_ops;
 	slot->release = &dummy_release;
 	slot->private = dslot;
@@ -375,4 +380,5 @@ MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 module_param(debug, bool, S_IRUGO | S_IWUSR);
 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");

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH v5 00/16] PCI: let the core manage slot names, Alex Chiang, (Wed Oct 8, 9:46 pm)
[PATCH v5 04/16] PCI: prevent duplicate slot names, Alex Chiang, (Wed Oct 8, 9:46 pm)
[PATCH v5 15/16] PCI: Hotplug core: remove 'name', Alex Chiang, (Wed Oct 8, 9:47 pm)
[PATCH v5 16/16] PCI Hotplug: fakephp: add duplicate slot ..., Alex Chiang, (Wed Oct 8, 9:47 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Kenji Kaneshige, (Wed Oct 8, 10:31 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Alex Chiang, (Wed Oct 8, 10:56 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Kenji Kaneshige, (Thu Oct 9, 5:32 am)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Kenji Kaneshige, (Thu Oct 9, 9:43 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Alex Chiang, (Thu Oct 9, 10:27 pm)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Kenji Kaneshige, (Fri Oct 10, 1:11 am)
Re: [PATCH v5 04/16] PCI: prevent duplicate slot names, Alex Chiang, (Fri Oct 10, 2:29 pm)