kernel/acpi: Use ACPI_SUCCESS()/ACPI_FAILURE() in a few places.
authorSascha Wildner <saw@online.de>
Sat, 10 May 2014 23:30:05 +0000 (01:30 +0200)
committerSascha Wildner <saw@online.de>
Sat, 10 May 2014 23:30:05 +0000 (01:30 +0200)
sys/dev/acpica/Osd/OsdSynch.c
sys/dev/acpica/acpi_ec.c
sys/dev/acpica/acpivar.h
sys/platform/pc32/acpica/OsdEnvironment.c
sys/platform/pc32/acpica/acpi_wakeup.c
sys/platform/pc64/acpica/OsdEnvironment.c

index c7332fb..863536a 100644 (file)
@@ -272,7 +272,9 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT16 Timeout)
            kprintf("%s: Timeout %d, pending %d, semaphore %p\n",
                __func__, Timeout, as->as_pendings, as);
        }
-       if (result == AE_OK && (as->as_timeouts > 0 || as->as_pendings > 0)) {
+       if (ACPI_SUCCESS(result) &&
+           (as->as_timeouts > 0 || as->as_pendings > 0))
+       {
            kprintf("%s: Acquire %d, units %d, pending %d, sem %p, thread %jd\n",
                __func__, Units, as->as_units, as->as_pendings, as,
                (intmax_t)AcpiOsGetThreadId());
index 34c8ba7..d68d3f5 100644 (file)
@@ -645,8 +645,8 @@ EcGpeQueryHandler(void *Context)
        Status = EcCommand(sc, EC_COMMAND_QUERY);
        if (ACPI_SUCCESS(Status))
            break;
-       if (EcCheckStatus(sc, "retr_check",
-           EC_EVENT_INPUT_BUFFER_EMPTY) == AE_OK)
+       if (ACPI_SUCCESS(EcCheckStatus(sc, "retr_check",
+           EC_EVENT_INPUT_BUFFER_EMPTY)))
            continue;
        else
            break;
@@ -836,7 +836,7 @@ EcWaitEvent(struct acpi_ec_softc *sc, EC_EVENT Event, u_int gen_count)
        DELAY(10);
        for (i = 0; i < count; i++) {
            Status = EcCheckStatus(sc, "poll", Event);
-           if (Status == AE_OK)
+           if (ACPI_SUCCESS(Status))
                break;
            DELAY(EC_POLL_DELAY);
        }
@@ -866,7 +866,7 @@ EcWaitEvent(struct acpi_ec_softc *sc, EC_EVENT Event, u_int gen_count)
             * event we are actually waiting for.
             */
            Status = EcCheckStatus(sc, "sleep", Event);
-           if (Status == AE_OK) {
+           if (ACPI_SUCCESS(Status)) {
                if (gen_count == sc->ec_gencount)
                    no_intr++;
                else
@@ -881,7 +881,7 @@ EcWaitEvent(struct acpi_ec_softc *sc, EC_EVENT Event, u_int gen_count)
         * read the register once and trust whatever value we got.  This is
         * the best we can do at this point.
         */
-       if (Status != AE_OK)
+       if (ACPI_FAILURE(Status))
            Status = EcCheckStatus(sc, "sleep_end", Event);
     }
     if (!need_poll && no_intr > 10) {
@@ -964,8 +964,8 @@ EcRead(struct acpi_ec_softc *sc, UINT8 Address, UINT8 *Data)
        EC_SET_DATA(sc, Address);
        status = EcWaitEvent(sc, EC_EVENT_OUTPUT_BUFFER_FULL, gen_count);
        if (ACPI_FAILURE(status)) {
-           if (EcCheckStatus(sc, "retr_check",
-               EC_EVENT_INPUT_BUFFER_EMPTY) == AE_OK)
+           if (ACPI_SUCCESS(EcCheckStatus(sc, "retr_check",
+               EC_EVENT_INPUT_BUFFER_EMPTY)))
                continue;
            else
                break;
index 071713f..c6c9cfa 100644 (file)
@@ -277,7 +277,7 @@ acpi_get_type(device_t dev)
 
     if ((h = acpi_get_handle(dev)) == NULL)
        return (ACPI_TYPE_NOT_FOUND);
-    if (AcpiGetType(h, &t) != AE_OK)
+    if (ACPI_FAILURE(AcpiGetType(h, &t)))
        return (ACPI_TYPE_NOT_FOUND);
     return (t);
 }
index f2939f3..92b0fa2 100644 (file)
@@ -66,7 +66,7 @@ AcpiOsGetRootPointer(void)
                 * manually here.
                 */
                status = AcpiFindRootPointer(&ptr);
-               if (status == AE_OK)
+               if (ACPI_SUCCESS(status))
                        i386_acpi_root = ptr;
        }
 
index 3b6af07..9f6f657 100644 (file)
@@ -260,7 +260,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
                else
                        status = AcpiEnterSleepState(state);
 
-               if (status != AE_OK) {
+               if (ACPI_FAILURE(status)) {
                        device_printf(sc->acpi_dev,
                                "AcpiEnterSleepState failed - %s\n",
                                AcpiFormatException(status));
index f2939f3..92b0fa2 100644 (file)
@@ -66,7 +66,7 @@ AcpiOsGetRootPointer(void)
                 * manually here.
                 */
                status = AcpiFindRootPointer(&ptr);
-               if (status == AE_OK)
+               if (ACPI_SUCCESS(status))
                        i386_acpi_root = ptr;
        }