aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/hotplug/rpaphp_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/hotplug/rpaphp_core.c')
-rw-r--r--drivers/pci/hotplug/rpaphp_core.c77
1 files changed, 13 insertions, 64 deletions
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c
index 29117a3a3287..22ec0993cf89 100644
--- a/drivers/pci/hotplug/rpaphp_core.c
+++ b/drivers/pci/hotplug/rpaphp_core.c
@@ -152,17 +152,7 @@ static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 * value)
152 int retval = 0; 152 int retval = 0;
153 153
154 down(&rpaphp_sem); 154 down(&rpaphp_sem);
155 /* have to go through this */ 155 retval = rpaphp_get_pci_adapter_status(slot, 0, value);
156 switch (slot->dev_type) {
157 case PCI_DEV:
158 retval = rpaphp_get_pci_adapter_status(slot, 0, value);
159 break;
160 case VIO_DEV:
161 retval = rpaphp_get_vio_adapter_status(slot, 0, value);
162 break;
163 default:
164 retval = -EINVAL;
165 }
166 up(&rpaphp_sem); 156 up(&rpaphp_sem);
167 return retval; 157 return retval;
168} 158}
@@ -362,12 +352,6 @@ int rpaphp_add_slot(struct device_node *dn)
362 352
363 dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name); 353 dbg("Entry %s: dn->full_name=%s\n", __FUNCTION__, dn->full_name);
364 354
365 if (dn->parent && is_vdevice_root(dn->parent)) {
366 /* register a VIO device */
367 retval = register_vio_slot(dn);
368 goto exit;
369 }
370
371 /* register PCI devices */ 355 /* register PCI devices */
372 if (dn->name != 0 && strcmp(dn->name, "pci") == 0) { 356 if (dn->name != 0 && strcmp(dn->name, "pci") == 0) {
373 if (is_php_dn(dn, &indexes, &names, &types, &power_domains)) 357 if (is_php_dn(dn, &indexes, &names, &types, &power_domains))
@@ -412,31 +396,6 @@ exit:
412 return retval; 396 return retval;
413} 397}
414 398
415/*
416 * init_slots - initialize 'struct slot' structures for each slot
417 *
418 */
419static void init_slots(void)
420{
421 struct device_node *dn;
422
423 for (dn = find_all_nodes(); dn; dn = dn->next)
424 rpaphp_add_slot(dn);
425}
426
427static int __init init_rpa(void)
428{
429
430 init_MUTEX(&rpaphp_sem);
431
432 /* initialize internal data structure etc. */
433 init_slots();
434 if (!num_slots)
435 return -ENODEV;
436
437 return 0;
438}
439
440static void __exit cleanup_slots(void) 399static void __exit cleanup_slots(void)
441{ 400{
442 struct list_head *tmp, *n; 401 struct list_head *tmp, *n;
@@ -458,10 +417,18 @@ static void __exit cleanup_slots(void)
458 417
459static int __init rpaphp_init(void) 418static int __init rpaphp_init(void)
460{ 419{
420 struct device_node *dn = NULL;
421
461 info(DRIVER_DESC " version: " DRIVER_VERSION "\n"); 422 info(DRIVER_DESC " version: " DRIVER_VERSION "\n");
423 init_MUTEX(&rpaphp_sem);
424
425 while ((dn = of_find_node_by_type(dn, "pci")))
426 rpaphp_add_slot(dn);
427
428 if (!num_slots)
429 return -ENODEV;
462 430
463 /* read all the PRA info from the system */ 431 return 0;
464 return init_rpa();
465} 432}
466 433
467static void __exit rpaphp_exit(void) 434static void __exit rpaphp_exit(void)
@@ -481,16 +448,7 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
481 448
482 dbg("ENABLING SLOT %s\n", slot->name); 449 dbg("ENABLING SLOT %s\n", slot->name);
483 down(&rpaphp_sem); 450 down(&rpaphp_sem);
484 switch (slot->dev_type) { 451 retval = rpaphp_enable_pci_slot(slot);
485 case PCI_DEV:
486 retval = rpaphp_enable_pci_slot(slot);
487 break;
488 case VIO_DEV:
489 retval = rpaphp_enable_vio_slot(slot);
490 break;
491 default:
492 retval = -EINVAL;
493 }
494 up(&rpaphp_sem); 452 up(&rpaphp_sem);
495exit: 453exit:
496 dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); 454 dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval);
@@ -511,16 +469,7 @@ static int disable_slot(struct hotplug_slot *hotplug_slot)
511 469
512 dbg("DISABLING SLOT %s\n", slot->name); 470 dbg("DISABLING SLOT %s\n", slot->name);
513 down(&rpaphp_sem); 471 down(&rpaphp_sem);
514 switch (slot->dev_type) { 472 retval = rpaphp_unconfig_pci_adapter(slot);
515 case PCI_DEV:
516 retval = rpaphp_unconfig_pci_adapter(slot);
517 break;
518 case VIO_DEV:
519 retval = rpaphp_unconfig_vio_adapter(slot);
520 break;
521 default:
522 retval = -ENODEV;
523 }
524 up(&rpaphp_sem); 473 up(&rpaphp_sem);
525exit: 474exit:
526 dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval); 475 dbg("%s - Exit: rc[%d]\n", __FUNCTION__, retval);