aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/rpaphp_core.c
diff options
context:
space:
mode:
authorlinas@austin.ibm.com <linas@austin.ibm.com>2006-01-12 19:26:27 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-31 21:00:12 -0500
commit8fe64399cccf8dddcc4e5eaff270a12064f6fe9f (patch)
treeaa7d9c3b842ded5d205fc70119128e618ef657e8 /drivers/pci/hotplug/rpaphp_core.c
parent8a85a70db8c65fd1703b4597f72fe6ee25642234 (diff)
[PATCH] powerpc/PCI hotplug: de-convolute rpaphp_unconfig_pci_adap
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>
Diffstat (limited to 'drivers/pci/hotplug/rpaphp_core.c')
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index cf075c34b578..acf17645fd8a 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -412,27 +412,31 @@ exit:
412 return retval; 412 return retval;
413} 413}
414 414
415static int disable_slot(struct hotplug_slot *hotplug_slot) 415static int __disable_slot(struct slot *slot)
416{ 416{
417 int retval = -EINVAL; 417 struct pci_dev *dev, *tmp;
418 struct slot *slot = (struct slot *)hotplug_slot->private;
419 418
420 dbg("%s - Entry: slot[%s]\n", __FUNCTION__, slot->name); 419 if (slot->state == NOT_CONFIGURED)
420 return -EINVAL;
421 421
422 if (slot->state == NOT_CONFIGURED) { 422 list_for_each_entry_safe(dev, tmp, &slot->bus->devices, bus_list) {
423 dbg("%s: %s is already disabled\n", __FUNCTION__, slot->name); 423 eeh_remove_bus_device(dev);
424 goto exit; 424 pci_remove_bus_device(dev);
425 } 425 }
426 426
427 dbg("DISABLING SLOT %s\n", slot->name); 427 slot->state = NOT_CONFIGURED;
428 return 0;
429}
430
431static int disable_slot(struct hotplug_slot *hotplug_slot)
432{
433 struct slot *slot = (struct slot *)hotplug_slot->private;
434 int retval;
435
428 down(&rpaphp_sem); 436 down(&rpaphp_sem);
429 retval = rpaphp_unconfig_pci_adapter(slot->bus); 437 retval = __disable_slot (slot);
430 up(&rpaphp_sem); 438 up(&rpaphp_sem);
431 slot->state = NOT_CONFIGURED; 439
432 info("%s: devices in slot[%s] unconfigured.\n", __FUNCTION__,
433 slot->name);
434exit:
435 dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval);
436 return retval; 440 return retval;
437} 441}
438 442