acpi: Use only AcpiGetSleepTypeData() to determine Sx support
Previously, we would first call AcpiEvaluateObject() to execute \_Sx before calling AcpiGetSleepTypeData(). This was unnecessary, as AcpiGetSleepTypeData() performs the same call itself. While doing so, the latter function logs any other error than AE_NOT_FOUND (which indicates that a particular sleep state is not supported), which most probably is an added benefit of this change. Reviewed by: obiwac MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D54624
This commit is contained in:
@@ -490,7 +490,6 @@ acpi_attach(device_t dev)
|
|||||||
ACPI_STATUS status;
|
ACPI_STATUS status;
|
||||||
int error, state;
|
int error, state;
|
||||||
UINT32 flags;
|
UINT32 flags;
|
||||||
UINT8 TypeA, TypeB;
|
|
||||||
char *env;
|
char *env;
|
||||||
enum power_stype stype;
|
enum power_stype stype;
|
||||||
|
|
||||||
@@ -688,13 +687,14 @@ acpi_attach(device_t dev)
|
|||||||
#if defined(__i386__) || defined(__amd64__)
|
#if defined(__i386__) || defined(__amd64__)
|
||||||
acpi_supported_stypes[POWER_STYPE_SUSPEND_TO_IDLE] = true;
|
acpi_supported_stypes[POWER_STYPE_SUSPEND_TO_IDLE] = true;
|
||||||
#endif
|
#endif
|
||||||
for (state = ACPI_STATE_S1; state <= ACPI_STATE_S5; state++)
|
for (state = ACPI_STATE_S1; state <= ACPI_STATE_S5; state++) {
|
||||||
if (ACPI_SUCCESS(AcpiEvaluateObject(ACPI_ROOT_OBJECT,
|
UINT8 TypeA, TypeB;
|
||||||
__DECONST(char *, AcpiGbl_SleepStateNames[state]), NULL, NULL)) &&
|
|
||||||
ACPI_SUCCESS(AcpiGetSleepTypeData(state, &TypeA, &TypeB))) {
|
if (ACPI_SUCCESS(AcpiGetSleepTypeData(state, &TypeA, &TypeB))) {
|
||||||
acpi_supported_sstates[state] = true;
|
acpi_supported_sstates[state] = true;
|
||||||
acpi_supported_stypes[acpi_sstate_to_stype(state)] = true;
|
acpi_supported_stypes[acpi_sstate_to_stype(state)] = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Dispatch the default sleep type to devices. The lid switch is set
|
* Dispatch the default sleep type to devices. The lid switch is set
|
||||||
|
|||||||
Reference in New Issue
Block a user