summaryrefslogtreecommitdiff
path: root/sys/dev/onewire
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2007-06-24 05:34:36 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2007-06-24 05:34:36 +0000
commit8919a22510bb2d5e5a6af011d229ac38e966a1a0 (patch)
treec5ffaca5117bee9e089dc3fc5c042d12f0e24d58 /sys/dev/onewire
parent741fb47166c6a7ffa0aea3684329acedb201ef7c (diff)
rework sensor tasks to use the kernels generic workq rather than a special
kernel thread of its own. the api has changed (which will be fixed in the manpage shortly) so all the users of sensor tasks that i can find have been fixed too. noone tested, so its going in to force people to run with it. "put it in" deraadt@
Diffstat (limited to 'sys/dev/onewire')
-rw-r--r--sys/dev/onewire/owsbm.c10
-rw-r--r--sys/dev/onewire/owtemp.c9
2 files changed, 13 insertions, 6 deletions
diff --git a/sys/dev/onewire/owsbm.c b/sys/dev/onewire/owsbm.c
index 8bbb7e5c5be..3f6ef634f2a 100644
--- a/sys/dev/onewire/owsbm.c
+++ b/sys/dev/onewire/owsbm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: owsbm.c,v 1.3 2007/06/01 23:35:00 cnst Exp $ */
+/* $OpenBSD: owsbm.c,v 1.4 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2007 Aaron Linville <aaron@linville.org>
@@ -69,6 +69,8 @@ struct owsbm_softc {
struct ksensor sc_voltage_vad; /* General purpose, AD = 0 */
struct ksensor sc_voltage_cr; /* Current Register */
+ struct sensor_task *sc_sensortask;
+
struct rwlock sc_lock;
};
@@ -132,7 +134,8 @@ owsbm_attach(struct device *parent, struct device *self, void *aux)
strlcpy(sc->sc_voltage_cr.desc, "CR", sizeof(sc->sc_voltage_cr.desc));
sensor_attach(&sc->sc_sensordev, &sc->sc_voltage_cr);
- if (sensor_task_register(sc, owsbm_update, 10)) {
+ sc->sc_sensortask = sensor_task_register(sc, owsbm_update, 10);
+ if (sc->sc_sensortask == NULL) {
printf(": unable to register owsbm update task\n");
return;
}
@@ -150,7 +153,8 @@ owsbm_detach(struct device *self, int flags)
rw_enter_write(&sc->sc_lock);
sensordev_deinstall(&sc->sc_sensordev);
- sensor_task_unregister(sc);
+ if (sc->sc_sensortask != NULL)
+ sensor_task_unregister(sc->sc_sensortask);
rw_exit_write(&sc->sc_lock);
return (0);
diff --git a/sys/dev/onewire/owtemp.c b/sys/dev/onewire/owtemp.c
index 47f78c67612..29250ff918f 100644
--- a/sys/dev/onewire/owtemp.c
+++ b/sys/dev/onewire/owtemp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: owtemp.c,v 1.7 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: owtemp.c,v 1.8 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -53,6 +53,7 @@ struct owtemp_softc {
struct ksensor sc_sensor;
struct ksensordev sc_sensordev;
+ struct sensor_task *sc_sensortask;
struct rwlock sc_lock;
};
@@ -100,7 +101,8 @@ owtemp_attach(struct device *parent, struct device *self, void *aux)
sizeof(sc->sc_sensordev.xname));
sc->sc_sensor.type = SENSOR_TEMP;
- if (sensor_task_register(sc, owtemp_update, 5)) {
+ sc->sc_sensortask = sensor_task_register(sc, owtemp_update, 5);
+ if (sc->sc_sensortask == NULL) {
printf(": unable to register update task\n");
return;
}
@@ -118,7 +120,8 @@ owtemp_detach(struct device *self, int flags)
rw_enter_write(&sc->sc_lock);
sensordev_deinstall(&sc->sc_sensordev);
- sensor_task_unregister(sc);
+ if (sc->sc_sensortask != NULL)
+ sensor_task_unregister(sc->sc_sensortask);
rw_exit_write(&sc->sc_lock);
return (0);