device_declaration = 1;
pr->acpi_id = value;
}
---- pr->apic_id = acpi_get_apicid(pr->handle, device_declaration,
---- pr->acpi_id);
---- cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
---- /* Handle UP system running SMP kernel, with no LAPIC in MADT */
---- if (!cpu0_initialized && (cpu_index == -1) &&
---- (num_online_cpus() == 1)) {
---- cpu_index = 0;
++++ apic_id = acpi_get_apicid(pr->handle, device_declaration, pr->acpi_id);
++++ if (apic_id < 0) {
- acpi_handle_err(pr->handle, "failed to get CPU APIC ID.\n");
+ ++++ acpi_handle_debug(pr->handle, "failed to get CPU APIC ID.\n");
++++ return -ENODEV;
}
++++ pr->apic_id = apic_id;
---- cpu0_initialized = 1;
----
++++ cpu_index = acpi_map_cpuid(pr->apic_id, pr->acpi_id);
++++ if (!cpu0_initialized) {
++++ cpu0_initialized = 1;
++++ /* Handle UP system running SMP kernel, with no LAPIC in MADT */
++++ if ((cpu_index == -1) && (num_online_cpus() == 1))
++++ cpu_index = 0;
++++ }
pr->id = cpu_index;
/*
*
* Must be called under acpi_scan_lock.
*/
- ---void acpi_bus_trim(struct acpi_device *start)
+ +++void acpi_bus_trim(struct acpi_device *adev)
{
+ +++ struct acpi_scan_handler *handler = adev->handler;
+ +++ struct acpi_device *child;
+ +++
+ +++ list_for_each_entry_reverse(child, &adev->children, node)
+ +++ acpi_bus_trim(child);
+ +++
++ +++ adev->flags.match_driver = false;
+ +++ if (handler) {
+ +++ if (handler->detach)
+ +++ handler->detach(adev);
+ +++
+ +++ adev->handler = NULL;
+ +++ } else {
+ +++ device_release_driver(&adev->dev);
+ +++ }
/*
- --- * Execute acpi_bus_device_detach() as a post-order callback to detach
- --- * all ACPI drivers from the device nodes being removed.
- --- */
- --- acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL,
- --- acpi_bus_device_detach, NULL, NULL);
- --- acpi_bus_device_detach(start->handle, 0, NULL, NULL);
- --- /*
- --- * Execute acpi_bus_remove() as a post-order callback to remove device
- --- * nodes in the given namespace scope.
+ +++ * Most likely, the device is going away, so put it into D3cold before
+ +++ * that.
*/
- --- acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL,
- --- acpi_bus_remove, NULL, NULL);
- --- acpi_bus_remove(start->handle, 0, NULL, NULL);
+ +++ acpi_device_set_power(adev, ACPI_STATE_D3_COLD);
+ +++ adev->flags.initialized = false;
+ +++ adev->flags.visited = false;
}
EXPORT_SYMBOL_GPL(acpi_bus_trim);