summaryrefslogtreecommitdiff
path: root/sys/arch/macppc/dev/smu.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/arch/macppc/dev/smu.c')
-rw-r--r--sys/arch/macppc/dev/smu.c17
1 files changed, 10 insertions, 7 deletions
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];