Initializes sensors states before registering.

This commit is contained in:
pgoyette 2011-06-20 17:48:45 +00:00
parent dba36e0322
commit 57e6b23a48
4 changed files with 14 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: cac.c,v 1.51 2010/11/13 13:52:00 uebayasi Exp $ */
/* $NetBSD: cac.c,v 1.52 2011/06/20 17:48:45 pgoyette Exp $ */
/*-
* Copyright (c) 2000, 2006, 2007 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.51 2010/11/13 13:52:00 uebayasi Exp $");
__KERNEL_RCSID(0, "$NetBSD: cac.c,v 1.52 2011/06/20 17:48:45 pgoyette Exp $");
#include "bio.h"
@ -683,6 +683,7 @@ cac_create_sensors(struct cac_softc *sc)
for (i = 0; i < nsensors; i++) {
sc->sc_sensor[i].units = ENVSYS_DRIVE;
sc->sc_sensor[i].state = ENVSYS_SINVALID;
/* Enable monitoring for drive state changes */
sc->sc_sensor[i].flags |= ENVSYS_FMONSTCHANGED;
/* logical drives */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ciss.c,v 1.25 2011/05/16 17:21:37 mhitch Exp $ */
/* $NetBSD: ciss.c,v 1.26 2011/06/20 17:48:45 pgoyette Exp $ */
/* $OpenBSD: ciss.c,v 1.14 2006/03/13 16:02:23 mickey Exp $ */
/*
@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.25 2011/05/16 17:21:37 mhitch Exp $");
__KERNEL_RCSID(0, "$NetBSD: ciss.c,v 1.26 2011/06/20 17:48:45 pgoyette Exp $");
#include "bio.h"
@ -1421,6 +1421,7 @@ ciss_create_sensors(struct ciss_softc *sc)
for (i = 0; i < nsensors; i++) {
sc->sc_sensor[i].units = ENVSYS_DRIVE;
sc->sc_sensor[i].state = ENVSYS_SINVALID;
/* Enable monitoring for drive state changes */
sc->sc_sensor[i].flags |= ENVSYS_FMONSTCHANGED;
/* logical drives */
@ -1436,7 +1437,8 @@ ciss_create_sensors(struct ciss_softc *sc)
sc->sc_sme->sme_cookie = sc;
sc->sc_sme->sme_refresh = ciss_sensor_refresh;
if (sysmon_envsys_register(sc->sc_sme)) {
printf("%s: unable to register with sysmon\n", device_xname(&sc->sc_dev));
printf("%s: unable to register with sysmon\n",
device_xname(&sc->sc_dev));
return(1);
}
return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mfi.c,v 1.34 2010/03/14 18:06:28 pgoyette Exp $ */
/* $NetBSD: mfi.c,v 1.35 2011/06/20 17:48:46 pgoyette Exp $ */
/* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
@ -17,7 +17,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.34 2010/03/14 18:06:28 pgoyette Exp $");
__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.35 2011/06/20 17:48:46 pgoyette Exp $");
#include "bio.h"
@ -2021,6 +2021,7 @@ mfi_create_sensors(struct mfi_softc *sc)
for (i = 0; i < nsensors; i++) {
sc->sc_sensor[i].units = ENVSYS_DRIVE;
sc->sc_sensor[i].state = ENVSYS_SINVALID;
/* Enable monitoring for drive state changes */
sc->sc_sensor[i].flags |= ENVSYS_FMONSTCHANGED;
/* logical drives */

View File

@ -1,4 +1,4 @@
/* $NetBSD: nslm7x.c,v 1.57 2011/03/05 22:27:21 jakllsch Exp $ */
/* $NetBSD: nslm7x.c,v 1.58 2011/06/20 17:48:46 pgoyette Exp $ */
/*-
* Copyright (c) 2000 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.57 2011/03/05 22:27:21 jakllsch Exp $");
__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.58 2011/06/20 17:48:46 pgoyette Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -1667,6 +1667,7 @@ lm_attach(struct lm_softc *lmsc)
lmsc->sc_sme = sysmon_envsys_create();
/* Initialize sensors */
for (i = 0; i < lmsc->numsensors; i++) {
lmsc->sensors[i].state = ENVSYS_SINVALID;
if (sysmon_envsys_sensor_attach(lmsc->sc_sme,
&lmsc->sensors[i])) {
sysmon_envsys_destroy(lmsc->sc_sme);