aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-13 17:27:25 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-22 22:00:24 -0400
commit236e26245a6a437c4afbf33a5ad94cf61d1a7a7c (patch)
tree2c8601200ae9dc7e3ee8387c287145b28f97c2f1
parentbda46dbb6626c923a800b4033c86fefa613cd64c (diff)
ACPI / hotplug / PCI: Rework namespace scanning and trimming routines
The acpiphp_bus_trim() and acpiphp_bus_add() functions need not return error codes that are never checked, so redefine them and simplify them a bit. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Tested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
-rw-r--r--drivers/pci/hotplug/acpiphp_glue.c52
1 files changed, 13 insertions, 39 deletions
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
index 7ac315afa430..b136eee7a93b 100644
--- a/drivers/pci/hotplug/acpiphp_glue.c
+++ b/drivers/pci/hotplug/acpiphp_glue.c
@@ -540,53 +540,27 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
540 return max; 540 return max;
541} 541}
542 542
543
544/** 543/**
545 * acpiphp_bus_add - add a new bus to acpi subsystem 544 * acpiphp_bus_trim - Trim device objects in an ACPI namespace subtree.
546 * @func: acpiphp_func of the bridge 545 * @handle: ACPI device object handle to start from.
547 */ 546 */
548static int acpiphp_bus_add(struct acpiphp_func *func) 547static void acpiphp_bus_trim(acpi_handle handle)
549{ 548{
550 acpi_handle handle = func_to_handle(func); 549 struct acpi_device *adev = NULL;
551 struct acpi_device *device;
552 int ret_val;
553
554 if (!acpi_bus_get_device(handle, &device)) {
555 dbg("bus exists... trim\n");
556 /* this shouldn't be in here, so remove
557 * the bus then re-add it...
558 */
559 acpi_bus_trim(device);
560 }
561 550
562 ret_val = acpi_bus_scan(handle); 551 acpi_bus_get_device(handle, &adev);
563 if (!ret_val) 552 if (adev)
564 ret_val = acpi_bus_get_device(handle, &device); 553 acpi_bus_trim(adev);
565
566 if (ret_val)
567 dbg("error adding bus, %x\n", -ret_val);
568
569 return ret_val;
570} 554}
571 555
572
573/** 556/**
574 * acpiphp_bus_trim - trim a bus from acpi subsystem 557 * acpiphp_bus_add - Scan ACPI namespace subtree.
575 * @handle: handle to acpi namespace 558 * @handle: ACPI object handle to start the scan from.
576 */ 559 */
577static int acpiphp_bus_trim(acpi_handle handle) 560static void acpiphp_bus_add(acpi_handle handle)
578{ 561{
579 struct acpi_device *device; 562 acpiphp_bus_trim(handle);
580 int retval; 563 acpi_bus_scan(handle);
581
582 retval = acpi_bus_get_device(handle, &device);
583 if (retval) {
584 dbg("acpi_device not found\n");
585 return retval;
586 }
587
588 acpi_bus_trim(device);
589 return 0;
590} 564}
591 565
592static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) 566static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
@@ -649,7 +623,7 @@ static int __ref enable_device(struct acpiphp_slot *slot)
649 goto err_exit; 623 goto err_exit;
650 624
651 list_for_each_entry(func, &slot->funcs, sibling) 625 list_for_each_entry(func, &slot->funcs, sibling)
652 acpiphp_bus_add(func); 626 acpiphp_bus_add(func_to_handle(func));
653 627
654 num = pci_scan_slot(bus, PCI_DEVFN(slot->device, 0)); 628 num = pci_scan_slot(bus, PCI_DEVFN(slot->device, 0));
655 if (num == 0) { 629 if (num == 0) {