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/arch/macppc/dev | |
parent | 2da4a587cf08c4fd33f160fe0f40ff89d9d3a3c3 (diff) |
adapt to new two-level sensor api; Constantine A. Murenin
Diffstat (limited to 'sys/arch/macppc/dev')
-rw-r--r-- | sys/arch/macppc/dev/asms.c | 11 | ||||
-rw-r--r-- | sys/arch/macppc/dev/smu.c | 17 |
2 files changed, 16 insertions, 12 deletions
diff --git a/sys/arch/macppc/dev/asms.c b/sys/arch/macppc/dev/asms.c index 17724436754..5c71f5219ec 100644 --- a/sys/arch/macppc/dev/asms.c +++ b/sys/arch/macppc/dev/asms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asms.c,v 1.3 2006/01/19 17:08:39 grange Exp $ */ +/* $OpenBSD: asms.c,v 1.4 2006/12/23 17:46:39 deraadt Exp $ */ /* * Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org> * @@ -62,6 +62,7 @@ struct asms_softc { i2c_addr_t sc_addr; struct sensor sc_sensor[ASMS_NUM_SENSORS]; + struct sensordev sc_sensordev; }; int asms_match(struct device *, void *, void *); @@ -247,9 +248,8 @@ asms_attach(struct device *parent, struct device *self, void *aux) iic_release_bus(sc->sc_tag, 0); /* Initialize sensor data. */ - for (i = 0; i < ASMS_NUM_SENSORS; i++) - strlcpy(sc->sc_sensor[i].device, sc->sc_dev.dv_xname, - sizeof(sc->sc_sensor[i].device)); + strlcpy(sc->sc_sensordev.xname, sc->sc_dev.dv_xname, + sizeof(sc->sc_sensordev.xname)); sc->sc_sensor[ASMS_DATA_X].type = SENSOR_INTEGER; strlcpy(sc->sc_sensor[ASMS_DATA_X].desc, "X_ACCEL", @@ -269,7 +269,8 @@ asms_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < ASMS_NUM_SENSORS; i++) - sensor_add(&sc->sc_sensor[i]); + sensor_attach(&sc->sc_sensordev, &sc->sc_sensor[i]); + sensordev_install(&sc->sc_sensordev); printf("\n"); } diff --git a/sys/arch/macppc/dev/smu.c b/sys/arch/macppc/dev/smu.c index da9c5a39b98..359ddfafa74 100644 --- a/sys/arch/macppc/dev/smu.c +++ b/sys/arch/macppc/dev/smu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smu.c,v 1.12 2006/03/20 22:40:18 kettenis Exp $ */ +/* $OpenBSD: smu.c,v 1.13 2006/12/23 17:46:39 deraadt Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -75,6 +75,8 @@ struct smu_softc { struct smu_sensor sc_sensors[SMU_MAXSENSORS]; int sc_num_sensors; + struct sensordev sc_sensordev; + u_int16_t sc_cpu_diode_scale; int16_t sc_cpu_diode_offset; u_int16_t sc_cpu_volt_scale; @@ -268,8 +270,6 @@ smu_attach(struct device *parent, struct device *self, void *aux) } fan = &sc->sc_fans[sc->sc_num_fans++]; - strlcpy(fan->sensor.device, sc->sc_dev.dv_xname, - sizeof(fan->sensor.device)); fan->sensor.type = SENSOR_FANRPM; fan->sensor.flags = SENSOR_FINVALID; fan->reg = reg; @@ -291,7 +291,7 @@ smu_attach(struct device *parent, struct device *self, void *aux) /* Start running fans at their "unmanaged" speed. */ smu_fan_set_rpm(sc, fan, fan->unmanaged_rpm); - sensor_add(&fan->sensor); + sensor_attach(&sc->sc_sensordev, &fan->sensor); } /* Sensors */ @@ -302,8 +302,6 @@ smu_attach(struct device *parent, struct device *self, void *aux) continue; sensor = &sc->sc_sensors[sc->sc_num_sensors++]; - strlcpy(sensor->sensor.device, sc->sc_dev.dv_xname, - sizeof(sensor->sensor.device)); sensor->sensor.flags = SENSOR_FINVALID; sensor->reg = val; @@ -321,9 +319,14 @@ smu_attach(struct device *parent, struct device *self, void *aux) strlcpy(loc, "Unknown", sizeof loc); strlcpy(sensor->sensor.desc, loc, sizeof sensor->sensor.desc); - sensor_add(&sensor->sensor); + sensor_attach(&sc->sc_sensordev, &sensor->sensor); } + /* Register sensor device with sysctl */ + strlcpy(sc->sc_sensordev.xname, sc->sc_dev.dv_xname, + sizeof(sc->sc_sensordev.xname)); + sensordev_install(&sc->sc_sensordev); + /* CPU temperature diode calibration */ smu_get_datablock(sc, 0x18, data, sizeof data); sc->sc_cpu_diode_scale = (data[4] << 8) + data[5]; |