diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-12-23 17:46:40 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2006-12-23 17:46:40 +0000 |
commit | 456453067d1414c6f4097d6aeaf996624183d72b (patch) | |
tree | b3a5f4f9a05a1aba0dd603c6eb3a6ff0cd86ee9f /sys/dev/pci/viaenv.c | |
parent | 2da4a587cf08c4fd33f160fe0f40ff89d9d3a3c3 (diff) |
adapt to new two-level sensor api; Constantine A. Murenin
Diffstat (limited to 'sys/dev/pci/viaenv.c')
-rw-r--r-- | sys/dev/pci/viaenv.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/sys/dev/pci/viaenv.c b/sys/dev/pci/viaenv.c index 9f7a16fb672..04d389b86d1 100644 --- a/sys/dev/pci/viaenv.c +++ b/sys/dev/pci/viaenv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: viaenv.c,v 1.8 2006/06/19 14:43:54 kettenis Exp $ */ +/* $OpenBSD: viaenv.c,v 1.9 2006/12/23 17:46:39 deraadt Exp $ */ /* $NetBSD: viaenv.c,v 1.9 2002/10/02 16:51:59 thorpej Exp $ */ /* @@ -70,6 +70,7 @@ struct viaenv_softc { int sc_fan_div[2]; /* fan RPM divisor */ struct sensor sc_data[VIANUMSENSORS]; + struct sensordev sc_sensordev; }; int viaenv_match(struct device *, void *, void *); @@ -283,25 +284,13 @@ viaenv_attach(struct device * parent, struct device * self, void *aux) goto nohwm; } - /* Initialize sensors */ - for (i = 0; i < VIANUMSENSORS; ++i) { - strlcpy(sc->sc_data[i].device, sc->sc_dev.dv_xname, - sizeof(sc->sc_data[i].device)); - sensor_add(&sc->sc_data[i]); - } - for (i = 0; i <= 2; i++) { sc->sc_data[i].type = SENSOR_TEMP; } - strlcpy(sc->sc_data[0].desc, "TSENS1", sizeof(sc->sc_data[0].desc)); - strlcpy(sc->sc_data[1].desc, "TSENS2", sizeof(sc->sc_data[1].desc)); - strlcpy(sc->sc_data[2].desc, "TSENS3", sizeof(sc->sc_data[2].desc)); for (i = 3; i <= 4; i++) { sc->sc_data[i].type = SENSOR_FANRPM; } - strlcpy(sc->sc_data[3].desc, "FAN1", sizeof(sc->sc_data[3].desc)); - strlcpy(sc->sc_data[4].desc, "FAN2", sizeof(sc->sc_data[4].desc)); for (i = 5; i <= 9; ++i) { sc->sc_data[i].type = SENSOR_VOLTS_DC; @@ -320,6 +309,13 @@ viaenv_attach(struct device * parent, struct device * self, void *aux) /* Get initial set of sensor values. */ viaenv_refresh_sensor_data(sc); + /* Register sensors with sysctl */ + strlcpy(sc->sc_sensordev.xname, sc->sc_dev.dv_xname, + sizeof(sc->sc_sensordev.xname)); + for (i = 0; i < VIANUMSENSORS; ++i) + sensor_attach(&sc->sc_sensordev, &sc->sc_data[i]); + sensordev_install(&sc->sc_sensordev); + /* Refresh sensors data every 1.5 seconds */ timeout_set(&viaenv_timeout, viaenv_refresh, sc); timeout_add(&viaenv_timeout, (15 * hz) / 10); |