summaryrefslogtreecommitdiffstats
path: root/sys/scsi/ses.c
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2007-06-24 05:34:35 +0000
committerdlg <dlg@openbsd.org>2007-06-24 05:34:35 +0000
commitabd9fc2824903fe1c710cba31e446d89a8bb4037 (patch)
tree5364d8d46ed4e16c142ac4efcb6c7be4dc4f5ea1 /sys/scsi/ses.c
parentImplement disk sizes > 2^32-1. Code modelled on NetBSD. (diff)
downloadwireguard-openbsd-abd9fc2824903fe1c710cba31e446d89a8bb4037.tar.xz
wireguard-openbsd-abd9fc2824903fe1c710cba31e446d89a8bb4037.zip
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/scsi/ses.c')
-rw-r--r--sys/scsi/ses.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/sys/scsi/ses.c b/sys/scsi/ses.c
index d3d0d8650be..1af264912fe 100644
--- a/sys/scsi/ses.c
+++ b/sys/scsi/ses.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ses.c,v 1.44 2007/05/04 23:44:37 krw Exp $ */
+/* $OpenBSD: ses.c,v 1.45 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -84,6 +84,7 @@ struct ses_softc {
#endif
TAILQ_HEAD(, ses_sensor) sc_sensors;
struct ksensordev sc_sensordev;
+ struct sensor_task *sc_sensortask;
};
struct cfattach ses_ca = {
@@ -169,18 +170,24 @@ ses_attach(struct device *parent, struct device *self, void *aux)
return;
}
- if (!TAILQ_EMPTY(&sc->sc_sensors) &&
- sensor_task_register(sc, ses_refresh_sensors, 10) != 0) {
- printf("%s: unable to register update task\n", DEVNAME(sc));
- while (!TAILQ_EMPTY(&sc->sc_sensors)) {
- sensor = TAILQ_FIRST(&sc->sc_sensors);
- TAILQ_REMOVE(&sc->sc_sensors, sensor, se_entry);
- free(sensor, M_DEVBUF);
+ if (!TAILQ_EMPTY(&sc->sc_sensors)) {
+ sc->sc_sensortask = sensor_task_register(sc,
+ ses_refresh_sensors, 10);
+ if (sc->sc_sensortask == NULL) {
+ printf("%s: unable to register update task\n",
+ DEVNAME(sc));
+ while (!TAILQ_EMPTY(&sc->sc_sensors)) {
+ sensor = TAILQ_FIRST(&sc->sc_sensors);
+ TAILQ_REMOVE(&sc->sc_sensors, sensor,
+ se_entry);
+ free(sensor, M_DEVBUF);
+ }
+ } else {
+ TAILQ_FOREACH(sensor, &sc->sc_sensors, se_entry)
+ sensor_attach(&sc->sc_sensordev,
+ &sensor->se_sensor);
+ sensordev_install(&sc->sc_sensordev);
}
- } else {
- TAILQ_FOREACH(sensor, &sc->sc_sensors, se_entry)
- sensor_attach(&sc->sc_sensordev, &sensor->se_sensor);
- sensordev_install(&sc->sc_sensordev);
}
#if NBIO > 0
@@ -229,7 +236,7 @@ ses_detach(struct device *self, int flags)
if (!TAILQ_EMPTY(&sc->sc_sensors)) {
sensordev_deinstall(&sc->sc_sensordev);
- sensor_task_unregister(sc);
+ sensor_task_unregister(sc->sc_sensortask);
while (!TAILQ_EMPTY(&sc->sc_sensors)) {
sensor = TAILQ_FIRST(&sc->sc_sensors);