From b65a9762747cbcaab36d9bab7a443d67ea44ef88 Mon Sep 17 00:00:00 2001 From: Can Erkin Acar Date: Sat, 23 Dec 2006 17:19:07 +0000 Subject: Correctly compute timeout value in acpi_sleep. Also make sure it is non zero. ok marco@ --- sys/dev/acpi/dsdt.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sys/dev') 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 @@ -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 -- cgit v1.2.3