X-Git-Url: http://www.pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=drivers%2Facpi%2Fec.c;h=e7e197e3a4ffce2151d61f5e6b48f89c98087dfa;hb=1ca721cdb748ba72c47e9c661d54696db3cde796;hp=caf873c14bfb244a89ba9c322ada05c3c2b3c04e;hpb=93d74463d018ddf05c169ad399e62e90e0f82fc0;p=linux-2.6-omap-h63xx.git diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index caf873c14bf..e7e197e3a4f 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -129,6 +129,7 @@ static struct acpi_ec { struct mutex lock; wait_queue_head_t wait; struct list_head list; + atomic_t irq_count; u8 handlers_installed; } *boot_ec, *first_ec; @@ -181,6 +182,8 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) { int ret = 0; + atomic_set(&ec->irq_count, 0); + if (unlikely(event == ACPI_EC_EVENT_OBF_1 && test_bit(EC_FLAGS_NO_OBF1_GPE, &ec->flags))) force_poll = 1; @@ -227,6 +230,7 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) while (time_before(jiffies, delay)) { if (acpi_ec_check_status(ec, event)) goto end; + msleep(5); } } pr_err(PREFIX "acpi_ec_wait timeout," @@ -529,6 +533,13 @@ static u32 acpi_ec_gpe_handler(void *data) struct acpi_ec *ec = data; pr_debug(PREFIX "~~~> interrupt\n"); + atomic_inc(&ec->irq_count); + if (atomic_read(&ec->irq_count) > 5) { + pr_err(PREFIX "GPE storm detected, disabling EC GPE\n"); + acpi_disable_gpe(NULL, ec->gpe, ACPI_ISR); + clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); + return ACPI_INTERRUPT_HANDLED; + } clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) wake_up(&ec->wait); @@ -943,11 +954,7 @@ int __init acpi_ec_ecdt_probe(void) boot_ec->command_addr = ecdt_ptr->control.address; boot_ec->data_addr = ecdt_ptr->data.address; boot_ec->gpe = ecdt_ptr->gpe; - if (ACPI_FAILURE(acpi_get_handle(NULL, ecdt_ptr->id, - &boot_ec->handle))) { - pr_info("Failed to locate handle for boot EC\n"); - boot_ec->handle = ACPI_ROOT_OBJECT; - } + boot_ec->handle = ACPI_ROOT_OBJECT; } else { /* This workaround is needed only on some broken machines, * which require early EC, but fail to provide ECDT */