Initialize sensors states before registering.

This commit is contained in:
pgoyette 2011-06-20 18:12:54 +00:00
parent e13c3a5c83
commit ac39d68c59
4 changed files with 15 additions and 8 deletions

View File

@ -1,5 +1,5 @@
/* $OpenBSD: fins.c,v 1.1 2008/03/19 19:33:09 deraadt Exp $ */
/* $NetBSD: finsio_isa.c,v 1.4 2008/04/22 13:33:38 xtraeme Exp $ */
/* $NetBSD: finsio_isa.c,v 1.5 2011/06/20 18:12:54 pgoyette Exp $ */
/*
* Copyright (c) 2008 Juan Romero Pardines
@ -19,7 +19,7 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: finsio_isa.c,v 1.4 2008/04/22 13:33:38 xtraeme Exp $");
__KERNEL_RCSID(0, "$NetBSD: finsio_isa.c,v 1.5 2011/06/20 18:12:54 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -542,6 +542,7 @@ finsio_isa_attach(device_t parent, device_t self, void *aux)
*/
sc->sc_sme = sysmon_envsys_create();
for (i = 0; sc->sc_finsio_sensors[i].fs_desc; i++) {
sc->sc_sensor[i].state = ENVSYS_SINVALID;
sc->sc_sensor[i].units = sc->sc_finsio_sensors[i].fs_type;
if (sc->sc_sensor[i].units == ENVSYS_SVOLTS_DC)
sc->sc_sensor[i].flags = ENVSYS_FCHANGERFACT;

View File

@ -1,4 +1,4 @@
/* $NetBSD: itesio_isa.c,v 1.21 2010/08/13 19:28:26 jakllsch Exp $ */
/* $NetBSD: itesio_isa.c,v 1.22 2011/06/20 18:12:54 pgoyette Exp $ */
/* Derived from $OpenBSD: it.c,v 1.19 2006/04/10 00:57:54 deraadt Exp $ */
/*
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.21 2010/08/13 19:28:26 jakllsch Exp $");
__KERNEL_RCSID(0, "$NetBSD: itesio_isa.c,v 1.22 2011/06/20 18:12:54 pgoyette Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -409,6 +409,10 @@ itesio_setup_sensors(struct itesio_softc *sc)
COPYDESCR(sc->sc_sensor[12].desc, "CPU Fan");
COPYDESCR(sc->sc_sensor[13].desc, "System Fan");
COPYDESCR(sc->sc_sensor[14].desc, "Aux Fan");
/* all */
for (i = 0; i < IT_NUM_SENSORS; i++)
sc->sc_sensor[i].state = ENVSYS_SINVALID;
}
#undef COPYDESCR

View File

@ -1,4 +1,4 @@
/* $NetBSD: nsclpcsio_isa.c,v 1.28 2008/11/12 12:36:12 ad Exp $ */
/* $NetBSD: nsclpcsio_isa.c,v 1.29 2011/06/20 18:12:54 pgoyette Exp $ */
/*
* Copyright (c) 2002
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nsclpcsio_isa.c,v 1.28 2008/11/12 12:36:12 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: nsclpcsio_isa.c,v 1.29 2011/06/20 18:12:54 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -309,6 +309,7 @@ nsclpcsio_envsys_init(struct nsclpcsio_softc *sc)
sme = sysmon_envsys_create();
for (i = 0; i < SIO_NUM_SENSORS; i++) {
sc->sc_sensor[i].state = ENVSYS_SINVALID;
if (sysmon_envsys_sensor_attach(sme, &sc->sc_sensor[i]) != 0) {
aprint_error_dev(sc->sc_dev,
"could not attach sensor %d", i);

View File

@ -1,4 +1,4 @@
/* $NetBSD: smsc.c,v 1.9 2009/05/12 09:10:16 cegger Exp $ */
/* $NetBSD: smsc.c,v 1.10 2011/06/20 18:12:54 pgoyette Exp $ */
/*-
* Copyright (c) 2007 The NetBSD Foundation, Inc.
@ -40,7 +40,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smsc.c,v 1.9 2009/05/12 09:10:16 cegger Exp $");
__KERNEL_RCSID(0, "$NetBSD: smsc.c,v 1.10 2011/06/20 18:12:54 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -212,6 +212,7 @@ smsc_attach(device_t parent, device_t self, void *aux)
INITSENSOR(7, "Fan3", SMSC_FAN4_LSB, ENVSYS_SFANRPM);
for (i = 0; i < SMSC_MAX_SENSORS; i++) {
sc->sc_sensor[i].state = ENVSYS_SINVALID;
if (sysmon_envsys_sensor_attach(sc->sc_sme,
&sc->sc_sensor[i])) {
sysmon_envsys_destroy(sc->sc_sme);