summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjordan <jordan@openbsd.org>2005-10-19 22:01:08 +0000
committerjordan <jordan@openbsd.org>2005-10-19 22:01:08 +0000
commita6b313592d333a63d4c2cdf31347e0d5dc97b170 (patch)
tree822bd2d4ab1761c0d834a06a75d17ecd95e2aecc
parentsmall cleanups while reading; ok claudio@ (diff)
downloadwireguard-openbsd-a6b313592d333a63d4c2cdf31347e0d5dc97b170.tar.xz
wireguard-openbsd-a6b313592d333a63d4c2cdf31347e0d5dc97b170.zip
Changed order of reading sensor vs sensor status, failed sensors had invalid
reading ok marco@
-rw-r--r--sys/dev/ipmi.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c
index a55b1d6cf97..836dad7e03b 100644
--- a/sys/dev/ipmi.c
+++ b/sys/dev/ipmi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipmi.c,v 1.9 2005/10/19 21:52:30 jordan Exp $ */
+/* $OpenBSD: ipmi.c,v 1.10 2005/10/19 22:01:08 jordan Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave
@@ -1254,6 +1254,25 @@ ipmi_sensor_status(struct ipmi_softc *sc, struct ipmi_sensor *psensor,
if (etype == 0x6F)
etype = (etype << 8) + psensor->stype;
+ /* Get reading of sensor */
+ switch (psensor->i_sensor.type) {
+ case SENSOR_TEMP:
+ psensor->i_sensor.value = ipmi_convert(reading[0], s1, 6);
+ psensor->i_sensor.value += 273150000;
+ break;
+
+ case SENSOR_VOLTS_DC:
+ psensor->i_sensor.value = ipmi_convert(reading[0], s1, 6);
+ break;
+
+ case SENSOR_FANRPM:
+ psensor->i_sensor.value = ipmi_convert(reading[0], s1, 0);
+ break;
+ default:
+ break;
+ }
+
+ /* Return Sensor Status */
switch(etype) {
case 0x01: /* threshold */
data[0] = psensor->i_num;
@@ -1301,24 +1320,6 @@ ipmi_sensor_status(struct ipmi_softc *sc, struct ipmi_sensor *psensor,
break;
}
- /* Get reading of sensor */
- switch (psensor->i_sensor.type) {
- case SENSOR_TEMP:
- psensor->i_sensor.value = ipmi_convert(reading[0], s1, 6);
- psensor->i_sensor.value += 273150000;
- break;
-
- case SENSOR_VOLTS_DC:
- psensor->i_sensor.value = ipmi_convert(reading[0], s1, 6);
- break;
-
- case SENSOR_FANRPM:
- psensor->i_sensor.value = ipmi_convert(reading[0], s1, 0);
- break;
- default:
- break;
- }
-
return (SENSOR_S_OK);
}