aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/ec.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/ec.c')
-rw-r--r--drivers/acpi/ec.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 3105e0410e9b..2e8317bf723e 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -982,9 +982,9 @@ static const struct acpi_device_id ec_device_ids[] = {
982 982
983int __init acpi_ec_ecdt_probe(void) 983int __init acpi_ec_ecdt_probe(void)
984{ 984{
985 int ret;
986 acpi_status status; 985 acpi_status status;
987 struct acpi_table_ecdt *ecdt_ptr; 986 struct acpi_table_ecdt *ecdt_ptr;
987 acpi_handle dummy;
988 988
989 boot_ec = make_acpi_ec(); 989 boot_ec = make_acpi_ec();
990 if (!boot_ec) 990 if (!boot_ec)
@@ -1010,30 +1010,31 @@ int __init acpi_ec_ecdt_probe(void)
1010 boot_ec->gpe = ecdt_ptr->gpe; 1010 boot_ec->gpe = ecdt_ptr->gpe;
1011 boot_ec->handle = ACPI_ROOT_OBJECT; 1011 boot_ec->handle = ACPI_ROOT_OBJECT;
1012 acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle); 1012 acpi_get_handle(ACPI_ROOT_OBJECT, ecdt_ptr->id, &boot_ec->handle);
1013 } else { 1013 /* Add some basic check against completely broken table */
1014 /* This workaround is needed only on some broken machines, 1014 if (boot_ec->data_addr != boot_ec->command_addr)
1015 * which require early EC, but fail to provide ECDT */ 1015 goto install;
1016 acpi_handle x; 1016 /* fall through */
1017 printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
1018 status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
1019 boot_ec, NULL);
1020 /* Check that acpi_get_devices actually find something */
1021 if (ACPI_FAILURE(status) || !boot_ec->handle)
1022 goto error;
1023 /* We really need to limit this workaround, the only ASUS,
1024 * which needs it, has fake EC._INI method, so use it as flag.
1025 * Keep boot_ec struct as it will be needed soon.
1026 */
1027 if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x)))
1028 return -ENODEV;
1029 } 1017 }
1030 1018 /* This workaround is needed only on some broken machines,
1031 ret = ec_install_handlers(boot_ec); 1019 * which require early EC, but fail to provide ECDT */
1032 if (!ret) { 1020 printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
1021 status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
1022 boot_ec, NULL);
1023 /* Check that acpi_get_devices actually find something */
1024 if (ACPI_FAILURE(status) || !boot_ec->handle)
1025 goto error;
1026 /* We really need to limit this workaround, the only ASUS,
1027 * which needs it, has fake EC._INI method, so use it as flag.
1028 * Keep boot_ec struct as it will be needed soon.
1029 */
1030 if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &dummy)))
1031 return -ENODEV;
1032install:
1033 if (!ec_install_handlers(boot_ec)) {
1033 first_ec = boot_ec; 1034 first_ec = boot_ec;
1034 return 0; 1035 return 0;
1035 } 1036 }
1036 error: 1037error:
1037 kfree(boot_ec); 1038 kfree(boot_ec);
1038 boot_ec = NULL; 1039 boot_ec = NULL;
1039 return -ENODEV; 1040 return -ENODEV;