diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2022-02-16 07:13:10 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2022-02-16 07:13:10 +0000 |
commit | 58641b63301ed8389a2a1045c0a855d378f7da2a (patch) | |
tree | 1e4a209305aded0ce5e2c8f8c0dece80b402333c | |
parent | 4ff5faf01a4d564d01c0136b1d04a24fd4436622 (diff) |
if the lids indicate we are not supposed to wakeup, return EAGAIN rather
than scheduling an acpi thread
-rw-r--r-- | sys/dev/acpi/acpi_x86.c | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/sys/dev/acpi/acpi_x86.c b/sys/dev/acpi/acpi_x86.c index 295912dc224..b9a2980cbcf 100644 --- a/sys/dev/acpi/acpi_x86.c +++ b/sys/dev/acpi/acpi_x86.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpi_x86.c,v 1.8 2022/02/16 06:41:27 deraadt Exp $ */ +/* $OpenBSD: acpi_x86.c,v 1.9 2022/02/16 07:13:09 deraadt Exp $ */ /* * Copyright (c) 2005 Thorsten Lockert <tholo@sigmasoft.com> * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -155,17 +155,28 @@ sleep_resume(void *v) return 0; } + +static int +checklids(struct acpi_softc *sc) +{ + extern int lid_action; + int lids; + + lids = acpibtn_numopenlids(); + if (lids == 0 && lid_action != 0) + return EAGAIN; + return 0; +} + + int suspend_finish(void *v) { struct acpi_softc *sc = v; - extern int lid_action; acpi_record_event(sc, APM_NORMAL_RESUME); acpi_indicator(sc, ACPI_SST_WORKING); /* If we woke up but all the lids are closed, go back to sleep */ - if (acpibtn_numopenlids() == 0 && lid_action != 0) - acpi_addtask(sc, acpi_sleep_task, sc, sc->sc_state); - return 0; + return checklids(sc); } |