The branch stable/15 has been updated by olce:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=6d6eca79f0d03468e4e91e9c5d014624f0dd7fbd

commit 6d6eca79f0d03468e4e91e9c5d014624f0dd7fbd
Author:     Olivier Certner <[email protected]>
AuthorDate: 2026-01-07 13:34:44 +0000
Commit:     Olivier Certner <[email protected]>
CommitDate: 2026-02-19 12:28:50 +0000

    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
    
    (cherry picked from commit 526c09a489295c96662d6c3d428f69672968ab80)
---
 sys/dev/acpica/acpi.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/sys/dev/acpica/acpi.c b/sys/dev/acpica/acpi.c
index a2159b12876f..7d067c880846 100644
--- a/sys/dev/acpica/acpi.c
+++ b/sys/dev/acpica/acpi.c
@@ -470,7 +470,6 @@ acpi_attach(device_t dev)
     ACPI_STATUS                status;
     int                        error, state;
     UINT32             flags;
-    UINT8              TypeA, TypeB;
     char               *env;
 
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@@ -656,11 +655,12 @@ acpi_attach(device_t dev)
 
     /* Probe all supported sleep states. */
     acpi_sleep_states[ACPI_STATE_S0] = TRUE;
-    for (state = ACPI_STATE_S1; state < ACPI_S_STATE_COUNT; 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_sleep_states[state] = TRUE;
+    }
 
     /*
      * Dispatch the default sleep state to devices.  The lid switch is set

Reply via email to