ChangeSet 1.1587.12.79, 2004/05/05 14:20:44-07:00, lxiep@us.ibm.com

[PATCH] PCI Hotplug: rpaphp doesn't initialize slot's name

Attached is a revised version of rpaphp.patch.  It has the following fixes:
- Set up slot->name
- Kill some dbgs
- Eike's fixes
- New fixes for incorrect "goto" in rpaphp_slot.c.


 drivers/pci/hotplug/rpaphp_pci.c  |    3 ++-
 drivers/pci/hotplug/rpaphp_slot.c |   17 ++++++-----------
 drivers/pci/hotplug/rpaphp_vio.c  |    1 +
 3 files changed, 9 insertions(+), 12 deletions(-)


diff -Nru a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c
--- a/drivers/pci/hotplug/rpaphp_pci.c	Mon May 17 16:57:48 2004
+++ b/drivers/pci/hotplug/rpaphp_pci.c	Mon May 17 16:57:48 2004
@@ -318,7 +318,8 @@
 		dealloc_slot_struct(slot);
 		return 1;
 	}
-
+	
+	strcpy(slot->name, pci_name(slot->bridge));
 	/* find slot's pci_dev if it's not empty */
 	if (slot->hotplug_slot->info->adapter_status == EMPTY) {
 		slot->state = EMPTY;	/* slot is empty */
diff -Nru a/drivers/pci/hotplug/rpaphp_slot.c b/drivers/pci/hotplug/rpaphp_slot.c
--- a/drivers/pci/hotplug/rpaphp_slot.c	Mon May 17 16:57:48 2004
+++ b/drivers/pci/hotplug/rpaphp_slot.c	Mon May 17 16:57:48 2004
@@ -80,28 +80,25 @@
 {
 	struct slot *slot;
 	
-	dbg("Enter %s: dn->full_name=%s drc_index=0x%x drc_name=%s\n",
-		__FUNCTION__, dn->full_name, drc_index, drc_name);
-
 	slot = kmalloc(sizeof (struct slot), GFP_KERNEL);
 	if (!slot)
 		goto error_nomem;
 	memset(slot, 0, sizeof (struct slot));
 	slot->hotplug_slot = kmalloc(sizeof (struct hotplug_slot), GFP_KERNEL);
 	if (!slot->hotplug_slot)
-		goto error_hpslot;
+		goto error_slot;
 	memset(slot->hotplug_slot, 0, sizeof (struct hotplug_slot));
 	slot->hotplug_slot->info = kmalloc(sizeof (struct hotplug_slot_info),
 					   GFP_KERNEL);
 	if (!slot->hotplug_slot->info)
-		goto error_hoslot;
+		goto error_hpslot;
 	memset(slot->hotplug_slot->info, 0, sizeof (struct hotplug_slot_info));
 	slot->hotplug_slot->name = kmalloc(BUS_ID_SIZE + 1, GFP_KERNEL);
 	if (!slot->hotplug_slot->name)
-		goto error_name;
+		goto error_info;
 	slot->location = kmalloc(strlen(drc_name) + 1, GFP_KERNEL);
 	if (!slot->location)
-		goto error_info;
+		goto error_name;
 	slot->name = slot->hotplug_slot->name;
 	slot->dn = dn;
 	slot->index = drc_index;
@@ -111,15 +108,13 @@
 	slot->hotplug_slot->ops = &rpaphp_hotplug_slot_ops;
 	slot->hotplug_slot->release = &rpaphp_release_slot;
 	slot->hotplug_slot->info->cur_bus_speed = PCI_SPEED_UNKNOWN;
-	dbg("Exit %s: slot->dn->full_name=%s drc_index=0x%x drc_name=%s\n",
-		__FUNCTION__, slot->dn->full_name, slot->index, slot->name);
 
 	return slot;
 
-error_info:
-	kfree(slot->hotplug_slot->info);
 error_name:
 	kfree(slot->hotplug_slot->name);
+error_info:
+	kfree(slot->hotplug_slot->info);
 error_hpslot:
 	kfree(slot->hotplug_slot);
 error_slot:
diff -Nru a/drivers/pci/hotplug/rpaphp_vio.c b/drivers/pci/hotplug/rpaphp_vio.c
--- a/drivers/pci/hotplug/rpaphp_vio.c	Mon May 17 16:57:48 2004
+++ b/drivers/pci/hotplug/rpaphp_vio.c	Mon May 17 16:57:48 2004
@@ -94,6 +94,7 @@
 		slot->state = NOT_CONFIGURED;
 	if (setup_vio_hotplug_slot_info(slot))
 		goto exit_rc;
+	strcpy(slot->name, slot->dev.vio_dev->dev.bus_id);
 	info("%s: registered VIO device[name=%s vio_dev=%p]\n",
 		__FUNCTION__, slot->name, slot->dev.vio_dev); 
 	rc = register_slot(slot);
