Module Name:    src
Committed By:   pgoyette
Date:           Wed Mar 24 12:15:54 UTC 2010

Modified Files:
        src/sys/dev/sysmon: sysmon_envsys.c

Log Message:
Do the initial refresh before creating the event monitors, in case the
event monitors require some of the data loaded by the refresh.  For
example, the initial refresh might load sensor limits and max_value in
addition to the cur_value.


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/dev/sysmon/sysmon_envsys.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.97 src/sys/dev/sysmon/sysmon_envsys.c:1.98
--- src/sys/dev/sysmon/sysmon_envsys.c:1.97	Sun Mar 14 18:03:15 2010
+++ src/sys/dev/sysmon/sysmon_envsys.c	Wed Mar 24 12:15:54 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.97 2010/03/14 18:03:15 pgoyette Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.98 2010/03/24 12:15:54 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.97 2010/03/14 18:03:15 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.98 2010/03/24 12:15:54 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -755,12 +755,20 @@
 
 out:
 	/*
-	 * No errors? register the events that were set in the driver
-	 * and make an initial data refresh if was requested.
+	 * No errors?  Make an initial data refresh if was requested,
+	 * then register the events that were set in the driver.  Do
+	 * the refresh first in case it is needed to establish the
+	 * limits or max_value needed by some events.
 	 */
 	if (error == 0) {
 		nevent = 0;
 		sysmon_task_queue_init();
+
+		if (sme->sme_flags & SME_INIT_REFRESH) {
+			sysmon_task_queue_sched(0, sme_initial_refresh, sme);
+			DPRINTF(("%s: scheduled initial refresh for '%s'\n",
+				__func__, sme->sme_name));
+		}
 		SLIST_FOREACH(evdv, &sme_evdrv_list, evdrv_head) {
 			sysmon_task_queue_sched(0,
 			    sme_event_drvadd, evdv->evdrv);
@@ -768,9 +776,6 @@
 		}
 		DPRINTF(("%s: driver '%s' registered (nsens=%d nevent=%d)\n",
 		    __func__, sme->sme_name, sme->sme_nsensors, nevent));
-
-		if (sme->sme_flags & SME_INIT_REFRESH)
-			sysmon_task_queue_sched(0, sme_initial_refresh, sme);
 	}
 
 out2:

Reply via email to