[PATCH 6/9] powerpc/PCI hotplug: de-convolute rpaphp_unconfig_pci_adapter()
linas
linas at austin.ibm.com
Wed Dec 14 06:56:06 EST 2005
John Rose,
Please review and sign off, and forward to Greg KH!
--linas
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 at austin.ibm.com>
Index: linux-2.6.15-rc5-mm2/drivers/pci/hotplug/rpadlpar_core.c
===================================================================
--- linux-2.6.15-rc5-mm2.orig/drivers/pci/hotplug/rpadlpar_core.c 2005-12-12 15:33:31.903511608 -0600
+++ linux-2.6.15-rc5-mm2/drivers/pci/hotplug/rpadlpar_core.c 2005-12-12 16:06:52.787105399 -0600
@@ -380,7 +380,11 @@
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: linux-2.6.15-rc5-mm2/drivers/pci/hotplug/rpaphp_core.c
===================================================================
--- linux-2.6.15-rc5-mm2.orig/drivers/pci/hotplug/rpaphp_core.c 2005-12-12 15:33:31.903511608 -0600
+++ linux-2.6.15-rc5-mm2/drivers/pci/hotplug/rpaphp_core.c 2005-12-12 16:07:46.806506500 -0600
@@ -412,27 +412,31 @@
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);
}
+
+ 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;
- dbg("DISABLING SLOT %s\n", slot->name);
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: linux-2.6.15-rc5-mm2/drivers/pci/hotplug/rpaphp_pci.c
===================================================================
--- linux-2.6.15-rc5-mm2.orig/drivers/pci/hotplug/rpaphp_pci.c 2005-12-12 15:34:35.763531664 -0600
+++ linux-2.6.15-rc5-mm2/drivers/pci/hotplug/rpaphp_pci.c 2005-12-12 16:06:53.403018759 -0600
@@ -116,18 +116,6 @@
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)
{
dbg("%s Initilize the PCI slot's hotplug->info structure ...\n",
Index: linux-2.6.15-rc5-mm2/drivers/pci/hotplug/rpaphp.h
===================================================================
--- linux-2.6.15-rc5-mm2.orig/drivers/pci/hotplug/rpaphp.h 2005-12-12 15:33:52.278646492 -0600
+++ linux-2.6.15-rc5-mm2/drivers/pci/hotplug/rpaphp.h 2005-12-12 16:06:53.403018759 -0600
@@ -92,8 +92,6 @@
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);
More information about the Linuxppc64-dev
mailing list