acpi: Fix not calling AcpiLeaveSleepState() in S3 path

When resuming from ACPI suspend, the ACPI_SS_SLP_PREP bit in slp_state
was being checked and subsequently unset when calling resumeclock().
This bit was also being checked for the AcpiLeaveSleepState() call in
the non-s2idle path, but having just been unset, it was never actually
being called.

Change this so that resumeclock() is always being called (since we never
goto breakout between suspendclock() and resumeclock() anyway) and
ACPI_SS_SLP_PREP is purely used for AcpiEnterSleepStatePrep() and
AcpiLeaveSleepState() in the non-s2idle paths.

PR:		292568
Reported by:	Marek Zarychta
Reviewed by:	olce
Tested by:	Marek Zarychta
Approved by:	olce
Fixes:	7669cbd0f0 (“acpi: Suspend-to-idle support (s2idle)”)
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D54777
This commit is contained in:
Aymeric Wibo
2026-01-19 14:19:52 +01:00
parent 709a53c8b2
commit 4b534b814a
+3 -6
View File
@@ -3645,8 +3645,8 @@ acpi_EnterSleepState(struct acpi_softc *sc, enum power_stype stype)
AcpiFormatException(status));
goto backout;
}
slp_state |= ACPI_SS_SLP_PREP;
}
slp_state |= ACPI_SS_SLP_PREP;
if (sc->acpi_sleep_delay > 0)
DELAY(sc->acpi_sleep_delay * 1000000);
@@ -3672,16 +3672,13 @@ acpi_EnterSleepState(struct acpi_softc *sc, enum power_stype stype)
case POWER_STYPE_UNKNOWN:
__unreachable();
}
resumeclock();
/*
* Back out state according to how far along we got in the suspend
* process. This handles both the error and success cases.
*/
backout:
if ((slp_state & ACPI_SS_SLP_PREP) != 0) {
resumeclock();
slp_state &= ~ACPI_SS_SLP_PREP;
}
if ((slp_state & ACPI_SS_GPE_SET) != 0) {
acpi_wake_prep_walk(sc, stype);
sc->acpi_stype = POWER_STYPE_AWAKE;
@@ -3691,7 +3688,7 @@ acpi_EnterSleepState(struct acpi_softc *sc, enum power_stype stype)
DEVICE_RESUME(root_bus);
slp_state &= ~ACPI_SS_DEV_SUSPEND;
}
if (stype != POWER_STYPE_SUSPEND_TO_IDLE && (slp_state & ACPI_SS_SLP_PREP) != 0) {
if ((slp_state & ACPI_SS_SLP_PREP) != 0) {
AcpiLeaveSleepState(acpi_sstate);
slp_state &= ~ACPI_SS_SLP_PREP;
}