1
0
mirror of https://git.FreeBSD.org/src.git synced 2026-06-02 11:24:32 +00:00

acpi: On /dev/power suspend, trigger userspace notifications

On a suspend request via ioctl(), /dev/acpi (and compatible /dev/apm)
both call acpi_ReqSleepState() instead of directly calling
acpi_EnterSleepState().  The former does more checks, returns success if
the machine is already suspending, and notifies user space (via devd(8))
about the impending suspend.  In other words, it seems to have been
designed for user consumption more than the latter function.

So, use acpi_ReqSleepState() in place of acpi_EnterSleepState() in
acpi_pm_func(), which is ultimately called by power_pm_suspend(), itself
called by power_ioctl().  Other callers of power_pm_suspend() (such as
the console drivers) are also user-facing facilities, so should also
benefit from this change.

Reviewed by:    mhorne, imp
Tested by:      mhorne
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D57239
This commit is contained in:
Olivier Certner
2026-05-25 18:01:10 +02:00
parent c6cefcbbbb
commit 44eb288313
+1 -1
View File
@@ -5064,7 +5064,7 @@ acpi_pm_func(u_long cmd, void *arg, enum power_stype stype)
error = EINVAL;
goto out;
}
if (ACPI_FAILURE(acpi_EnterSleepState(sc, stype)))
if (ACPI_FAILURE(acpi_ReqSleepState(sc, stype)))
error = ENXIO;
break;
default: