Index: sys/dev/acpica/acpi_ec.c =================================================================== --- sys/dev/acpica/acpi_ec.c (revision 277405) +++ sys/dev/acpica/acpi_ec.c (working copy) @@ -620,7 +620,7 @@ EcGpeQueryHandler(void *Context) struct acpi_ec_softc *sc = (struct acpi_ec_softc *)Context; UINT8 Data; ACPI_STATUS Status; - int retry, sci_enqueued; + int retry; char qxx[5]; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -631,7 +631,7 @@ EcGpeQueryHandler(void *Context) if (ACPI_FAILURE(Status)) { device_printf(sc->ec_dev, "GpeQuery lock error: %s\n", AcpiFormatException(Status)); - return; + goto finish; } /* @@ -641,7 +641,6 @@ EcGpeQueryHandler(void *Context) * that may arise from running the query from causing another query * to be queued, we clear the pending flag only after running it. */ - sci_enqueued = sc->ec_sci_pend; for (retry = 0; retry < 2; retry++) { Status = EcCommand(sc, EC_COMMAND_QUERY); if (ACPI_SUCCESS(Status)) @@ -657,7 +656,7 @@ EcGpeQueryHandler(void *Context) EcUnlock(sc); device_printf(sc->ec_dev, "GPE query failed: %s\n", AcpiFormatException(Status)); - return; + goto finish; } Data = EC_GET_DATA(sc); @@ -671,7 +670,7 @@ EcGpeQueryHandler(void *Context) /* Ignore the value for "no outstanding event". (13.3.5) */ CTR2(KTR_ACPI, "ec query ok,%s running _Q%02X", Data ? "" : " not", Data); if (Data == 0) - return; + goto finish; /* Evaluate _Qxx to respond to the controller. */ snprintf(qxx, sizeof(qxx), "_Q%02X", Data); @@ -682,13 +681,12 @@ EcGpeQueryHandler(void *Context) qxx, AcpiFormatException(Status)); } - /* Reenable runtime GPE if its execution was deferred. */ - if (sci_enqueued) { - Status = AcpiFinishGpe(sc->ec_gpehandle, sc->ec_gpebit); - if (ACPI_FAILURE(Status)) - device_printf(sc->ec_dev, "reenabling runtime GPE failed: %s\n", - AcpiFormatException(Status)); - } +finish: + /* Reenable runtime GPE. */ + Status = AcpiFinishGpe(sc->ec_gpehandle, sc->ec_gpebit); + if (ACPI_FAILURE(Status)) + device_printf(sc->ec_dev, "reenabling runtime GPE failed: %s\n", + AcpiFormatException(Status)); } /* @@ -722,13 +720,12 @@ EcGpeHandler(ACPI_HANDLE GpeDevice, UINT32 GpeNumb if ((EcStatus & EC_EVENT_SCI) && !sc->ec_sci_pend) { CTR0(KTR_ACPI, "ec gpe queueing query handler"); Status = AcpiOsExecute(OSL_GPE_HANDLER, EcGpeQueryHandler, Context); - if (ACPI_SUCCESS(Status)) { + if (ACPI_SUCCESS(Status)) sc->ec_sci_pend = TRUE; - return (0); - } else + else printf("EcGpeHandler: queuing GPE query handler failed\n"); } - return (ACPI_REENABLE_GPE); + return (0); } static ACPI_STATUS