diff options
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/ec.c | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 167af373bab3..3d9362140831 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -708,9 +708,6 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval) | |||
708 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe); | 708 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe); |
709 | if (ACPI_FAILURE(status)) | 709 | if (ACPI_FAILURE(status)) |
710 | return status; | 710 | return status; |
711 | /* Find and register all query methods */ | ||
712 | acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1, | ||
713 | acpi_ec_register_query_methods, ec, NULL); | ||
714 | /* Use the global lock for all EC transactions? */ | 711 | /* Use the global lock for all EC transactions? */ |
715 | acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); | 712 | acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock); |
716 | ec->handle = handle; | 713 | ec->handle = handle; |
@@ -745,31 +742,28 @@ static int acpi_ec_add(struct acpi_device *device) | |||
745 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | 742 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); |
746 | 743 | ||
747 | /* Check for boot EC */ | 744 | /* Check for boot EC */ |
748 | if (boot_ec) { | 745 | if (boot_ec && |
749 | if (boot_ec->handle == device->handle) { | 746 | (boot_ec->handle == device->handle || |
750 | /* Pre-loaded EC from DSDT, just move pointer */ | 747 | boot_ec->handle == ACPI_ROOT_OBJECT)) { |
751 | ec = boot_ec; | 748 | ec = boot_ec; |
752 | boot_ec = NULL; | 749 | boot_ec = NULL; |
753 | goto end; | 750 | } else { |
754 | } else if (boot_ec->handle == ACPI_ROOT_OBJECT) { | 751 | ec = make_acpi_ec(); |
755 | /* ECDT-based EC, time to shut it down */ | 752 | if (!ec) |
756 | ec_remove_handlers(boot_ec); | 753 | return -ENOMEM; |
757 | kfree(boot_ec); | 754 | if (ec_parse_device(device->handle, 0, ec, NULL) != |
758 | first_ec = boot_ec = NULL; | 755 | AE_CTRL_TERMINATE) { |
756 | kfree(ec); | ||
757 | return -EINVAL; | ||
759 | } | 758 | } |
760 | } | 759 | } |
761 | 760 | ||
762 | ec = make_acpi_ec(); | ||
763 | if (!ec) | ||
764 | return -ENOMEM; | ||
765 | |||
766 | if (ec_parse_device(device->handle, 0, ec, NULL) != | ||
767 | AE_CTRL_TERMINATE) { | ||
768 | kfree(ec); | ||
769 | return -EINVAL; | ||
770 | } | ||
771 | ec->handle = device->handle; | 761 | ec->handle = device->handle; |
772 | end: | 762 | |
763 | /* Find and register all query methods */ | ||
764 | acpi_walk_namespace(ACPI_TYPE_METHOD, ec->handle, 1, | ||
765 | acpi_ec_register_query_methods, ec, NULL); | ||
766 | |||
773 | if (!first_ec) | 767 | if (!first_ec) |
774 | first_ec = ec; | 768 | first_ec = ec; |
775 | acpi_driver_data(device) = ec; | 769 | acpi_driver_data(device) = ec; |
@@ -924,6 +918,7 @@ int __init acpi_ec_ecdt_probe(void) | |||
924 | boot_ec->data_addr = ecdt_ptr->data.address; | 918 | boot_ec->data_addr = ecdt_ptr->data.address; |
925 | boot_ec->gpe = ecdt_ptr->gpe; | 919 | boot_ec->gpe = ecdt_ptr->gpe; |
926 | boot_ec->handle = ACPI_ROOT_OBJECT; | 920 | boot_ec->handle = ACPI_ROOT_OBJECT; |
921 | acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); | ||
927 | } else { | 922 | } else { |
928 | /* This workaround is needed only on some broken machines, | 923 | /* This workaround is needed only on some broken machines, |
929 | * which require early EC, but fail to provide ECDT */ | 924 | * which require early EC, but fail to provide ECDT */ |