ACPI: EC: disable GPE during QUERY handling too. From: Alexey Starikovskiy --- drivers/acpi/ec.c | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 8d6b7e9..e027077 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -226,9 +226,16 @@ static void acpi_ec_gpe_query(void *ec_cxt); static int ec_check_sci(struct acpi_ec *ec, u8 state) { if (state & ACPI_EC_FLAG_SCI) { - if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) + if (!test_and_set_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) { + /* disable GPE until next transaction */ + if (in_interrupt() && + test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { + clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); + acpi_disable_gpe(NULL, ec->gpe, ACPI_ISR); + } return acpi_os_execute(OSL_EC_BURST_HANDLER, acpi_ec_gpe_query, ec); + } } return 0; } @@ -281,8 +288,9 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, if (test_bit(EC_FLAGS_GPE_STORM, &ec->flags)) { /* check if we received SCI during transaction */ ec_check_sci(ec, acpi_ec_read_status(ec)); - /* it is safe to enable GPE outside of transaction */ - acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); + /* we expect query, enable GPE back */ + if (!test_bit(EC_FLAGS_QUERY_PENDING, &ec->flags)) + acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR); } else if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags) && ec->irq_count > ACPI_EC_STORM_THRESHOLD) { pr_debug(PREFIX "GPE storm detected\n");