Module Name:    src
Committed By:   pgoyette
Date:           Mon Aug 27 14:08:36 UTC 2012

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

Log Message:
Simplify some logic - no functional change intended.

While here, clean up a couple of comments.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 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.122 src/sys/dev/sysmon/sysmon_envsys.c:1.123
--- src/sys/dev/sysmon/sysmon_envsys.c:1.122	Thu Jul 19 13:31:06 2012
+++ src/sys/dev/sysmon/sysmon_envsys.c	Mon Aug 27 14:08:36 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.122 2012/07/19 13:31:06 pgoyette Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.123 2012/08/27 14:08:36 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.122 2012/07/19 13:31:06 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.123 2012/08/27 14:08:36 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -516,7 +516,7 @@ sysmon_envsys_destroy(struct sysmon_envs
 /*
  * sysmon_envsys_sensor_attach:
  *
- * 	+ Attachs a sensor into a sysmon_envsys device checking that units
+ * 	+ Attaches a sensor into a sysmon_envsys device checking that units
  * 	  is set to a valid type and description is unique and not empty.
  */
 int
@@ -555,7 +555,7 @@ sysmon_envsys_sensor_attach(struct sysmo
 	TAILQ_INSERT_TAIL(&sme->sme_sensors_list, edata, sensors_head);
 
 	/*
-	 * Give the sensor a index position.
+	 * Give the sensor an index position.
 	 */
 	edata->sensor = sme->sme_nsensors;
 	sme->sme_nsensors++;
@@ -1290,6 +1290,7 @@ sme_add_sensor_dictionary(struct sysmon_
 	int error;
 	sme_event_drv_t *sme_evdrv_t = NULL;
 	char indexstr[ENVSYS_DESCLEN];
+	bool mon_supported, allow_rfact;
 
 	/*
 	 * Add the index sensor string.
@@ -1328,13 +1329,12 @@ sme_add_sensor_dictionary(struct sysmon_
 	    (edata->units == ENVSYS_INDICATOR) ||
 	    (edata->units == ENVSYS_DRIVE) ||
 	    (edata->units == ENVSYS_BATTERY_CAPACITY) ||
-	    (edata->units == ENVSYS_BATTERY_CHARGE)) {
-		if (sme_sensor_upbool(dict, "monitoring-supported", false))
-			goto out;
-	} else {
-		if (sme_sensor_upbool(dict, "monitoring-supported", true))
+	    (edata->units == ENVSYS_BATTERY_CHARGE))
+		mon_supported = false;
+	else
+		mon_supported = true;
+	if (sme_sensor_upbool(dict, "monitoring-supported", mon_supported))
 			goto out;
-	}
 
 	/*
 	 * Add the allow-rfact boolean object, true if
@@ -1347,13 +1347,12 @@ sme_add_sensor_dictionary(struct sysmon_
 	 */
 	if (edata->units == ENVSYS_SVOLTS_DC ||
 	    edata->units == ENVSYS_SVOLTS_AC) {
-		if (edata->flags & ENVSYS_FCHANGERFACT) {
-			if (sme_sensor_upbool(dict, "allow-rfact", true))
-				goto out;
-		} else {
-			if (sme_sensor_upbool(dict, "allow-rfact", false))
+		if (edata->flags & ENVSYS_FCHANGERFACT)
+			allow_rfact = true;
+		else
+			allow_rfact = false;
+		if (sme_sensor_upbool(dict, "allow-rfact", allow_rfact))
 				goto out;
-		}
 	}
 
 	error = sme_update_sensor_dictionary(dict, edata,

Reply via email to