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:28:22 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2006-01-31 21:00:13 -0500
commite06b80b78db96ca272db4ec0b26ce1092a1a9704 (patch)
tree77f8605f27e02c46b1513837e4fc1f02b6d2b66c /drivers/pci/hotplug/rpaphp_core.c
parent8fe64399cccf8dddcc4e5eaff270a12064f6fe9f (diff)
[PATCH] powerpc/PCI hotplug: merge rpaphp_enable_pci_slot()
Remove general baroqueness. The function rpaphp_enable_pci_slot() has a fairly simple logic structure, once all of the debug printk's are removed. Its called from only one place, and that place also has a very simple structure once he printk's are removed. Merge the two together. 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.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index acf17645fd8a..341fdd59090b 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -393,22 +393,40 @@ static void __exit rpaphp_exit(void)
393 cleanup_slots(); 393 cleanup_slots();
394} 394}
395 395
396static int enable_slot(struct hotplug_slot *hotplug_slot) 396static int __enable_slot(struct slot *slot)
397{ 397{
398 int retval = 0; 398 int state;
399 struct slot *slot = (struct slot *)hotplug_slot->private; 399 int retval;
400 400
401 if (slot->state == CONFIGURED) { 401 if (slot->state == CONFIGURED)
402 dbg("%s: %s is already enabled\n", __FUNCTION__, slot->name); 402 return 0;
403 goto exit; 403
404 retval = rpaphp_get_sensor_state(slot, &state);
405 if (retval)
406 return retval;
407
408 if (state == PRESENT) {
409 pcibios_add_pci_devices(slot->bus);
410 slot->state = CONFIGURED;
411 } else if (state == EMPTY) {
412 slot->state = EMPTY;
413 } else {
414 err("%s: slot[%s] is in invalid state\n", __FUNCTION__, slot->name);
415 slot->state = NOT_VALID;
416 return -EINVAL;
404 } 417 }
418 return 0;
419}
420
421static int enable_slot(struct hotplug_slot *hotplug_slot)
422{
423 int retval;
424 struct slot *slot = (struct slot *)hotplug_slot->private;
405 425
406 dbg("ENABLING SLOT %s\n", slot->name);
407 down(&rpaphp_sem); 426 down(&rpaphp_sem);
408 retval = rpaphp_enable_pci_slot(slot); 427 retval = __enable_slot(slot);
409 up(&rpaphp_sem); 428 up(&rpaphp_sem);
410exit: 429
411 dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval);
412 return retval; 430 return retval;
413} 431}
414 432