diff options
| author | Olivier Certner <olce@FreeBSD.org> | 2026-01-07 13:34:44 +0000 |
|---|---|---|
| committer | Olivier Certner <olce@FreeBSD.org> | 2026-01-28 11:26:37 +0000 |
| commit | 526c09a489295c96662d6c3d428f69672968ab80 (patch) | |
| tree | eb98e63ca2edcb0321b14364c76c16929f1cdeba | |
| parent | 149e6c67ca80e72066ff84a0138914a6896559fb (diff) | |
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
| -rw-r--r-- | sys/dev/acpica/acpi.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c index e43ef72ca9d2..6da406377d4b 100644 --- a/sys/dev/acpica/acpi.c +++ b/sys/dev/acpica/acpi.c @@ -490,7 +490,6 @@ acpi_attach(device_t dev) ACPI_STATUS status; int error, state; UINT32 flags; - UINT8 TypeA, TypeB; char *env; enum power_stype stype; @@ -688,13 +687,14 @@ acpi_attach(device_t dev) #if defined(__i386__) || defined(__amd64__) acpi_supported_stypes[POWER_STYPE_SUSPEND_TO_IDLE] = true; #endif - for (state = ACPI_STATE_S1; state <= ACPI_STATE_S5; state++) - if (ACPI_SUCCESS(AcpiEvaluateObject(ACPI_ROOT_OBJECT, - __DECONST(char *, AcpiGbl_SleepStateNames[state]), NULL, NULL)) && - ACPI_SUCCESS(AcpiGetSleepTypeData(state, &TypeA, &TypeB))) { + for (state = ACPI_STATE_S1; state <= ACPI_STATE_S5; state++) { + UINT8 TypeA, TypeB; + + if (ACPI_SUCCESS(AcpiGetSleepTypeData(state, &TypeA, &TypeB))) { acpi_supported_sstates[state] = true; acpi_supported_stypes[acpi_sstate_to_stype(state)] = true; } + } /* * Dispatch the default sleep type to devices. The lid switch is set |
