summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCan Erkin Acar <canacar@cvs.openbsd.org>2006-12-23 17:19:07 +0000
committerCan Erkin Acar <canacar@cvs.openbsd.org>2006-12-23 17:19:07 +0000
commitb65a9762747cbcaab36d9bab7a443d67ea44ef88 (patch)
tree3c6de3ff646de08afbcb280d8ea70d5464161423
parentaa564e4d1447e6e038d00984127a4e7607cb30b0 (diff)
Correctly compute timeout value in acpi_sleep.
Also make sure it is non zero. ok marco@
-rw-r--r--sys/dev/acpi/dsdt.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index fcbc3aadd5c..a6a5ff6d64d 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.72 2006/12/20 22:45:26 deraadt Exp $ */
+/* $OpenBSD: dsdt.c,v 1.73 2006/12/23 17:19:06 canacar Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
@@ -402,11 +402,16 @@ _acpi_os_free(void *ptr, const char *fn, int line)
void
acpi_sleep(int ms)
{
+ int to = ms * hz / 1000;
+
if (cold)
delay(ms * 1000);
- else
- while (tsleep(dsdt_softc, PWAIT, "asleep", ms / hz) !=
+ else {
+ if (to <= 0)
+ to = 1;
+ while (tsleep(dsdt_softc, PWAIT, "asleep", to) !=
EWOULDBLOCK);
+ }
}
void