summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2001-02-06 00:15:02 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2001-02-06 00:15:02 +0000
commita64bc62d54ad86a3b2fa0197206f5e5766d59241 (patch)
treed344ce639ac979c78ab551cdb89cd7bbbe2d327d
parent89dfa6867780b9bf05b6e1430441a75acca409cd (diff)
only call apm_perror() if get_event() failed
-rw-r--r--sys/arch/i386/i386/apm.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/sys/arch/i386/i386/apm.c b/sys/arch/i386/i386/apm.c
index c9f0637ee9a..f04b18ca834 100644
--- a/sys/arch/i386/i386/apm.c
+++ b/sys/arch/i386/i386/apm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: apm.c,v 1.43 2001/01/02 16:16:50 mickey Exp $ */
+/* $OpenBSD: apm.c,v 1.44 2001/02/06 00:15:01 mickey Exp $ */
/*-
* Copyright (c) 1998-2000 Michael Shalayeff. All rights reserved.
@@ -525,13 +525,17 @@ apm_periodic_check(sc)
if (apm_op_inprog)
apm_set_powstate(APM_DEV_ALLDEVS, APM_LASTREQ_INPROG);
- while (apm_get_event(&regs) == 0)
- if (apm_handle_event(sc, &regs))
+ while (1) {
+ if (apm_get_event(&regs) != 0) {
+ /* i think some bioses combine the error codes */
+ if (!(APM_ERR_CODE(&regs) & APM_ERR_NOEVENTS))
+ apm_perror("get event", &regs);
break;
+ }
- /* i think some bioses actually combine the error codes */
- if (!(APM_ERR_CODE(&regs) & APM_ERR_NOEVENTS))
- apm_perror("periodic get event", &regs);
+ if (apm_handle_event(sc, &regs))
+ break;
+ }
if (apm_error || APM_ERR_CODE(&regs) == APM_ERR_NOTCONN)
ret = -1;