ChangeSet 1.1587.12.5, 2004/04/29 14:07:10-07:00, johnrose@austin.ibm.com

[PATCH] PCI Hotplug: RPA DLPAR remove slot, return code fix


 drivers/pci/hotplug/rpadlpar_core.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)


diff -Nru a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c
--- a/drivers/pci/hotplug/rpadlpar_core.c	Mon May 17 17:08:38 2004
+++ b/drivers/pci/hotplug/rpadlpar_core.c	Mon May 17 17:08:38 2004
@@ -47,15 +47,13 @@
 {
 	struct device_node *child;
 	struct device_node *parent = of_find_node_by_name(NULL, "vdevice");
+	char *loc_code;
 
 	if (!parent)
 		return NULL;
 
-	for (child = of_get_next_child(parent, NULL);	
+	for (child = of_get_next_child(parent, NULL);
 	     child; child = of_get_next_child(parent, child)) {
-	
-		char *loc_code;
-	
 		loc_code = get_property(child, "ibm,loc-code", NULL);
 		if (loc_code && !strcmp(loc_code, drc_name))
 			return child;
@@ -309,12 +307,8 @@
  */
 int dlpar_remove_pci_slot(struct slot *slot, char *drc_name)
 {
-	struct device_node *dn = find_php_slot_pci_node(drc_name);
 	struct pci_dev *bridge_dev;
 
-	if (!dn)
-		return -ENODEV;
-
 	bridge_dev = slot->bridge;
 	if (!bridge_dev) {
 		printk(KERN_ERR "%s: unexpected null bridge device\n",
@@ -358,13 +352,19 @@
 
 	if (down_interruptible(&rpadlpar_sem))
 		return -ERESTARTSYS;
-	
+
+	if (!find_php_slot_vio_node(drc_name) &&
+	    !find_php_slot_pci_node(drc_name)) {
+		rc = -ENODEV;
+		goto exit;
+	}
+
 	slot = find_slot(drc_name);
 	if (!slot) {
 		rc = -EINVAL;
 		goto exit;
 	}
-	
+
 	switch (slot->dev_type) {
 		case PCI_DEV:
 			rc = dlpar_remove_pci_slot(slot, drc_name);
