Subject: sysmon_power bug?
To: None <tech-kern@netbsd.org>
From: Jachym Holecek <freza@dspfpga.com>
List: tech-kern
Date: 06/07/2006 22:44:47
Hello,

at a glance, it seems that sys/dev/sysmon/sysmon_power.c will silently
keep rewriting event #0 when events are pushed on the queue, and never
use other elements of the queue. Is the diff below OK to commit?

	-- Jachym

Index: sysmon_power.c
===================================================================
RCS file: /cvsroot/src/sys/dev/sysmon/sysmon_power.c,v
retrieving revision 1.11
diff -u -r1.11 sysmon_power.c
--- sysmon_power.c	11 Dec 2005 12:23:56 -0000	1.11
+++ sysmon_power.c	7 Jun 2006 20:29:31 -0000
@@ -77,7 +77,7 @@
 
 #define	PEVQ_F_WAITING		0x01	/* daemon waiting for event */
 
-#define	SYSMON_NEXT_EVENT(x)		(((x) + 1) / SYSMON_MAX_POWER_EVENTS)
+#define	SYSMON_NEXT_EVENT(x)		(((x) + 1) % SYSMON_MAX_POWER_EVENTS)
 
 /*
  * sysmon_queue_power_event: