Do sensors inits before trying to attach them on the sysmon_envsys

device.
This commit is contained in:
njoly 2007-11-19 12:16:44 +00:00
parent e96c994011
commit 40dffa27fd

View File

@ -1,4 +1,4 @@
/* $NetBSD: viaenv.c,v 1.25 2007/11/16 08:00:16 xtraeme Exp $ */
/* $NetBSD: viaenv.c,v 1.26 2007/11/19 12:16:44 njoly Exp $ */
/*
* Copyright (c) 2000 Johan Danielsson
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: viaenv.c,v 1.25 2007/11/16 08:00:16 xtraeme Exp $");
__KERNEL_RCSID(0, "$NetBSD: viaenv.c,v 1.26 2007/11/19 12:16:44 njoly Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -316,17 +316,6 @@ viaenv_attach(struct device *parent, struct device *self, void *aux)
goto nohwm;
}
sc->sc_sme = sysmon_envsys_create();
/* Initialize sensors */
for (i = 0; i < VIANUMSENSORS; i++) {
if (sysmon_envsys_sensor_attach(sc->sc_sme,
&sc->sc_sensor[i])) {
sysmon_envsys_destroy(sc->sc_sme);
return;
}
}
for (i = 0; i < 3; i++)
sc->sc_sensor[i].units = ENVSYS_STEMP;
@ -356,6 +345,17 @@ viaenv_attach(struct device *parent, struct device *self, void *aux)
#undef COPYDESCR
sc->sc_sme = sysmon_envsys_create();
/* Initialize sensors */
for (i = 0; i < VIANUMSENSORS; i++) {
if (sysmon_envsys_sensor_attach(sc->sc_sme,
&sc->sc_sensor[i])) {
sysmon_envsys_destroy(sc->sc_sme);
return;
}
}
/*
* Hook into the System Monitor.
*/