ACPI: EC: Don't delete boot EC

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
Alexey Starikovskiy
2008-03-24 23:22:36 +03:00
committed by Len Brown
parent 6d9e112063
commit ce52ddf58c

View File

@@ -708,9 +708,6 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe); status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe);
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return status; return status;
/* Find and register all query methods */
acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1,
acpi_ec_register_query_methods, ec, NULL);
/* Use the global lock for all EC transactions? */ /* Use the global lock for all EC transactions? */
acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock);
ec->handle = handle; ec->handle = handle;
@@ -745,31 +742,28 @@ static int acpi_ec_add(struct acpi_device *device)
strcpy(acpi_device_class(device), ACPI_EC_CLASS); strcpy(acpi_device_class(device), ACPI_EC_CLASS);
/* Check for boot EC */ /* Check for boot EC */
if (boot_ec) { if (boot_ec &&
if (boot_ec->handle == device->handle) { (boot_ec->handle == device->handle ||
/* Pre-loaded EC from DSDT, just move pointer */ boot_ec->handle == ACPI_ROOT_OBJECT)) {
ec = boot_ec; ec = boot_ec;
boot_ec = NULL; boot_ec = NULL;
goto end; } else {
} else if (boot_ec->handle == ACPI_ROOT_OBJECT) { ec = make_acpi_ec();
/* ECDT-based EC, time to shut it down */ if (!ec)
ec_remove_handlers(boot_ec); return -ENOMEM;
kfree(boot_ec); if (ec_parse_device(device->handle, 0, ec, NULL) !=
first_ec = boot_ec = NULL; AE_CTRL_TERMINATE) {
kfree(ec);
return -EINVAL;
} }
} }
ec = make_acpi_ec();
if (!ec)
return -ENOMEM;
if (ec_parse_device(device->handle, 0, ec, NULL) !=
AE_CTRL_TERMINATE) {
kfree(ec);
return -EINVAL;
}
ec->handle = device->handle; ec->handle = device->handle;
end:
/* Find and register all query methods */
acpi_walk_namespace(ACPI_TYPE_METHOD, ec->handle, 1,
acpi_ec_register_query_methods, ec, NULL);
if (!first_ec) if (!first_ec)
first_ec = ec; first_ec = ec;
acpi_driver_data(device) = ec; acpi_driver_data(device) = ec;
@@ -924,6 +918,7 @@ int __init acpi_ec_ecdt_probe(void)
boot_ec->data_addr = ecdt_ptr->data.address; boot_ec->data_addr = ecdt_ptr->data.address;
boot_ec->gpe = ecdt_ptr->gpe; boot_ec->gpe = ecdt_ptr->gpe;
boot_ec->handle = ACPI_ROOT_OBJECT; boot_ec->handle = ACPI_ROOT_OBJECT;
acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle);
} else { } else {
/* This workaround is needed only on some broken machines, /* This workaround is needed only on some broken machines,
* which require early EC, but fail to provide ECDT */ * which require early EC, but fail to provide ECDT */