Consistently use ACPI_SUCCESS() and ACPI_FAILURE() macros wherever possible.

This commit is contained in:
Jung-uk Kim 2012-06-01 21:33:33 +00:00
parent b5ae8dbaa5
commit 9ad569771a
5 changed files with 13 additions and 15 deletions

View File

@ -263,8 +263,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
status = AcpiEnterSleepStateS4bios();
else
status = AcpiEnterSleepState(state, acpi_sleep_flags);
if (status != AE_OK) {
if (ACPI_FAILURE(status)) {
device_printf(sc->acpi_dev,
"AcpiEnterSleepState failed - %s\n",
AcpiFormatException(status));

View File

@ -208,7 +208,7 @@ AcpiOsWaitSemaphore(ACPI_SEMAPHORE Handle, UINT32 Units, UINT16 Timeout)
tmo -= slptick;
}
}
if (status == AE_OK)
if (ACPI_SUCCESS(status))
as->as_units -= Units;
mtx_unlock(&as->as_lock);
@ -402,7 +402,7 @@ AcpiOsAcquireMutex(ACPI_MUTEX Handle, UINT16 Timeout)
tmo -= slptick;
}
}
if (status == AE_OK)
if (ACPI_SUCCESS(status))
am->am_owner = curthread;
mtx_unlock(&am->am_lock);

View File

@ -649,8 +649,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;
@ -845,7 +845,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);
}
@ -875,7 +875,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
@ -890,7 +890,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) {
@ -898,7 +898,7 @@ EcWaitEvent(struct acpi_ec_softc *sc, EC_EVENT Event, u_int gen_count)
"not getting interrupts, switched to polled mode\n");
ec_polled_mode = 1;
}
if (Status != AE_OK)
if (ACPI_FAILURE(Status))
CTR0(KTR_ACPI, "error: ec wait timed out");
return (Status);
}
@ -977,8 +977,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;

View File

@ -273,7 +273,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);
}

View File

@ -249,8 +249,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
status = AcpiEnterSleepStateS4bios();
else
status = AcpiEnterSleepState(state, acpi_sleep_flags);
if (status != AE_OK) {
if (ACPI_FAILURE(status)) {
device_printf(sc->acpi_dev,
"AcpiEnterSleepState failed - %s\n",
AcpiFormatException(status));