]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[PATCH] powerpc/PCI hotplug: de-convolute rpaphp_unconfig_pci_adap
authorlinas@austin.ibm.com <linas@austin.ibm.com>
Fri, 13 Jan 2006 00:26:27 +0000 (18:26 -0600)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 1 Feb 2006 02:00:12 +0000 (18:00 -0800)
Remove general baroqueness.  The function rpaphp_unconfig_pci_adapter()
is really just three lines of code, once all the dbg printks are removed.
And its called in only one place. So replace the call by the thre lines.
Also, provide proper semaphore locking in the affected function
disable_slot()

Signed-off-by: Linas Vepstas <linas@austin.ibm.com>
Acked-by: John Rose <johnrose@austin.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/hotplug/rpadlpar_core.c
drivers/pci/hotplug/rpaphp.h
drivers/pci/hotplug/rpaphp_core.c
drivers/pci/hotplug/rpaphp_pci.c

index 6c148106518efe47a9ed9fbf4e278c46ac2c5cd1..15e853e5e6893bc49218ef4a3567a96d2125577b 100644 (file)
@@ -380,7 +380,11 @@ int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn)
                        return -EIO;
                }
        } else {
-               rpaphp_unconfig_pci_adapter(bus);
+               struct pci_dev *dev, *tmp;
+               list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
+                       eeh_remove_bus_device(dev);
+                       pci_remove_bus_device(dev);
+               }
        }
 
        if (unmap_bus_range(bus)) {
index 89d705c7c502ad257ca2c3c671e7d0abce80e283..6e4f93ba6555e73abd5b68ae9eac75e8505c9527 100644 (file)
@@ -92,8 +92,6 @@ extern int rpaphp_enable_pci_slot(struct slot *slot);
 extern int register_pci_slot(struct slot *slot);
 extern int rpaphp_get_pci_adapter_status(struct slot *slot, int is_init, u8 * value);
 
-extern int rpaphp_unconfig_pci_adapter(struct pci_bus *bus);
-
 /* rpaphp_core.c */
 extern int rpaphp_add_slot(struct device_node *dn);
 extern int rpaphp_remove_slot(struct slot *slot);
index cf075c34b578c4e4048b47da205efb882acff96f..acf17645fd8aa893e4ab2ad97aef26bbaee5f78b 100644 (file)
@@ -412,27 +412,31 @@ exit:
        return retval;
 }
 
-static int disable_slot(struct hotplug_slot *hotplug_slot)
+static int __disable_slot(struct slot *slot)
 {
-       int retval = -EINVAL;
-       struct slot *slot = (struct slot *)hotplug_slot->private;
+       struct pci_dev *dev, *tmp;
 
-       dbg("%s - Entry: slot[%s]\n", __FUNCTION__, slot->name);
+       if (slot->state == NOT_CONFIGURED)
+               return -EINVAL;
 
-       if (slot->state == NOT_CONFIGURED) {
-               dbg("%s: %s is already disabled\n", __FUNCTION__, slot->name);
-               goto exit;
+       list_for_each_entry_safe(dev, tmp, &slot->bus->devices, bus_list) {
+               eeh_remove_bus_device(dev);
+               pci_remove_bus_device(dev);
        }
 
-       dbg("DISABLING SLOT %s\n", slot->name);
+       slot->state = NOT_CONFIGURED;
+       return 0;
+}
+
+static int disable_slot(struct hotplug_slot *hotplug_slot)
+{
+       struct slot *slot = (struct slot *)hotplug_slot->private;
+       int retval;
+
        down(&rpaphp_sem);
-       retval = rpaphp_unconfig_pci_adapter(slot->bus);
+       retval = __disable_slot (slot);
        up(&rpaphp_sem);
-       slot->state = NOT_CONFIGURED;
-       info("%s: devices in slot[%s] unconfigured.\n", __FUNCTION__,
-            slot->name);
-exit:
-       dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval);
+
        return retval;
 }
 
index 1f5e73be47c74c877b9f2cb143e03d1fb7061dce..ce7ebec05933215d7c1e2c1b8e6f5ca9a85e273a 100644 (file)
@@ -116,18 +116,6 @@ static void print_slot_pci_funcs(struct pci_bus *bus)
        return;
 }
 
-int rpaphp_unconfig_pci_adapter(struct pci_bus *bus)
-{
-       struct pci_dev *dev, *tmp;
-
-       list_for_each_entry_safe(dev, tmp, &bus->devices, bus_list) {
-               eeh_remove_bus_device(dev);
-               pci_remove_bus_device(dev);
-       }
-       return 0;
-}
-EXPORT_SYMBOL_GPL(rpaphp_unconfig_pci_adapter);
-
 static int setup_pci_hotplug_slot_info(struct slot *slot)
 {
        struct hotplug_slot_info *hotplug_slot_info = slot->hotplug_slot->info;