Commit 236e2624 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent bda46dbb
...@@ -540,53 +540,27 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus) ...@@ -540,53 +540,27 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus)
return max; return max;
} }
/** /**
* acpiphp_bus_add - add a new bus to acpi subsystem * acpiphp_bus_trim - Trim device objects in an ACPI namespace subtree.
* @func: acpiphp_func of the bridge * @handle: ACPI device object handle to start from.
*/ */
static int acpiphp_bus_add(struct acpiphp_func *func) static void acpiphp_bus_trim(acpi_handle handle)
{ {
acpi_handle handle = func_to_handle(func); struct acpi_device *adev = NULL;
struct acpi_device *device;
int ret_val;
if (!acpi_bus_get_device(handle, &device)) {
dbg("bus exists... trim\n");
/* this shouldn't be in here, so remove
* the bus then re-add it...
*/
acpi_bus_trim(device);
}
ret_val = acpi_bus_scan(handle); acpi_bus_get_device(handle, &adev);
if (!ret_val) if (adev)
ret_val = acpi_bus_get_device(handle, &device); acpi_bus_trim(adev);
if (ret_val)
dbg("error adding bus, %x\n", -ret_val);
return ret_val;
} }
/** /**
* acpiphp_bus_trim - trim a bus from acpi subsystem * acpiphp_bus_add - Scan ACPI namespace subtree.
* @handle: handle to acpi namespace * @handle: ACPI object handle to start the scan from.
*/ */
static int acpiphp_bus_trim(acpi_handle handle) static void acpiphp_bus_add(acpi_handle handle)
{ {
struct acpi_device *device; acpiphp_bus_trim(handle);
int retval; acpi_bus_scan(handle);
retval = acpi_bus_get_device(handle, &device);
if (retval) {
dbg("acpi_device not found\n");
return retval;
}
acpi_bus_trim(device);
return 0;
} }
static void acpiphp_set_acpi_region(struct acpiphp_slot *slot) static void acpiphp_set_acpi_region(struct acpiphp_slot *slot)
...@@ -649,7 +623,7 @@ static int __ref enable_device(struct acpiphp_slot *slot) ...@@ -649,7 +623,7 @@ static int __ref enable_device(struct acpiphp_slot *slot)
goto err_exit; goto err_exit;
list_for_each_entry(func, &slot->funcs, sibling) list_for_each_entry(func, &slot->funcs, sibling)
acpiphp_bus_add(func); acpiphp_bus_add(func_to_handle(func));
num = pci_scan_slot(bus, PCI_DEVFN(slot->device, 0)); num = pci_scan_slot(bus, PCI_DEVFN(slot->device, 0));
if (num == 0) { if (num == 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment