ChangeSet 1.1358.21.3, 2003/07/13 12:53:45-04:00, scottm@minion.yyz.somanetworks.com

[CPCI] Minimal fixes to restore CPCI hotplug to working order

Removed double kfree in unconfigure_visit_pci_dev_phase2, and
added a call to pci_bus_add_devices in cpci_configure_slot.


 drivers/pci/hotplug/cpci_hotplug_pci.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)


diff -Nru a/drivers/pci/hotplug/cpci_hotplug_pci.c b/drivers/pci/hotplug/cpci_hotplug_pci.c
--- a/drivers/pci/hotplug/cpci_hotplug_pci.c	Mon Jul 14 16:55:35 2003
+++ b/drivers/pci/hotplug/cpci_hotplug_pci.c	Mon Jul 14 16:55:35 2003
@@ -494,9 +494,7 @@
 		return -ENODEV;
 
 	/* Remove the Linux representation */
-	if(pci_remove_device_safe(dev) == 0) {
-		kfree(dev);
-	} else {
+	if(pci_remove_device_safe(dev)) {
 		err("Could not remove device\n");
 		return -1;
 	}
@@ -574,13 +572,18 @@
 
 	/* Still NULL? Well then scan for it! */
 	if(slot->dev == NULL) {
+		int n;
 		dbg("pci_dev still null");
 
 		/*
 		 * This will generate pci_dev structures for all functions, but
 		 * we will only call this case when lookup fails.
 		 */
-		slot->dev = pci_scan_slot(slot->bus, slot->devfn);
+		n = pci_scan_slot(slot->bus, slot->devfn);
+		dbg("%s: pci_scan_slot returned %d", __FUNCTION__, n);
+		if(n > 0)
+			pci_bus_add_devices(slot->bus);
+		slot->dev = pci_find_slot(slot->bus->number, slot->devfn);
 		if(slot->dev == NULL) {
 			err("Could not find PCI device for slot %02x", slot->number);
 			return 0;
