summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/macppc/dev/asms.c4
-rw-r--r--sys/arch/sparc64/dev/pcf8591_ofw.c4
-rw-r--r--sys/dev/i2c/ad741x.c4
-rw-r--r--sys/dev/i2c/adm1021.c4
-rw-r--r--sys/dev/i2c/adm1024.c4
-rw-r--r--sys/dev/i2c/adm1025.c4
-rw-r--r--sys/dev/i2c/adm1026.c4
-rw-r--r--sys/dev/i2c/adm1030.c4
-rw-r--r--sys/dev/i2c/adm1031.c4
-rw-r--r--sys/dev/i2c/adt7460.c4
-rw-r--r--sys/dev/i2c/asb100.c4
-rw-r--r--sys/dev/i2c/ds1631.c4
-rw-r--r--sys/dev/i2c/fcu.c4
-rw-r--r--sys/dev/i2c/fintek.c4
-rw-r--r--sys/dev/i2c/gl518sm.c4
-rw-r--r--sys/dev/i2c/lm87.c4
-rw-r--r--sys/dev/i2c/maxim6690.c4
-rw-r--r--sys/dev/i2c/pca9554.c4
-rw-r--r--sys/dev/i2c/tsl2560.c4
-rw-r--r--sys/dev/i2c/w83l784r.c4
-rw-r--r--sys/dev/ic/ami.c4
-rw-r--r--sys/dev/ic/ciss.c4
-rw-r--r--sys/dev/ic/lm78.c8
-rw-r--r--sys/dev/ic/lm78var.h3
-rw-r--r--sys/dev/ic/mfi.c4
-rw-r--r--sys/dev/isa/it.c4
-rw-r--r--sys/dev/onewire/owsbm.c10
-rw-r--r--sys/dev/onewire/owtemp.c9
-rw-r--r--sys/dev/pci/arc.c4
-rw-r--r--sys/dev/softraid.c4
-rw-r--r--sys/kern/kern_sensors.c160
-rw-r--r--sys/scsi/safte.c29
-rw-r--r--sys/scsi/ses.c33
-rw-r--r--sys/sys/sensors.h7
34 files changed, 185 insertions, 178 deletions
diff --git a/sys/arch/macppc/dev/asms.c b/sys/arch/macppc/dev/asms.c
index 9937a890483..50621c33179 100644
--- a/sys/arch/macppc/dev/asms.c
+++ b/sys/arch/macppc/dev/asms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asms.c,v 1.5 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: asms.c,v 1.6 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org>
*
@@ -263,7 +263,7 @@ asms_attach(struct device *parent, struct device *self, void *aux)
strlcpy(sc->sc_sensor[ASMS_DATA_Z].desc, "Z_ACCEL",
sizeof(sc->sc_sensor[ASMS_DATA_Z].desc));
- if (sensor_task_register(sc, asms_refresh, 5)) {
+ if (sensor_task_register(sc, asms_refresh, 5) == NULL) {
printf(": unable to register update task\n");
return;
}
diff --git a/sys/arch/sparc64/dev/pcf8591_ofw.c b/sys/arch/sparc64/dev/pcf8591_ofw.c
index 9c637732dc9..b93297a03c6 100644
--- a/sys/arch/sparc64/dev/pcf8591_ofw.c
+++ b/sys/arch/sparc64/dev/pcf8591_ofw.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pcf8591_ofw.c,v 1.3 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: pcf8591_ofw.c,v 1.4 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2006 Damien Miller <djm@openbsd.org>
@@ -178,7 +178,7 @@ pcfadc_attach(struct device *parent, struct device *self, void *aux)
sensor_attach(&sc->sc_sensordev,
&sc->sc_channels[i].chan_sensor);
- if (sensor_task_register(sc, pcfadc_refresh, 5)) {
+ if (sensor_task_register(sc, pcfadc_refresh, 5) == NULL) {
printf(": unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/ad741x.c b/sys/dev/i2c/ad741x.c
index 0c82851cfa8..75810de22ac 100644
--- a/sys/dev/i2c/ad741x.c
+++ b/sys/dev/i2c/ad741x.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ad741x.c,v 1.11 2007/04/09 19:31:22 kettenis Exp $ */
+/* $OpenBSD: ad741x.c,v 1.12 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -139,7 +139,7 @@ adc_attach(struct device *parent, struct device *self, void *aux)
nsens += 3;
}
- if (sensor_task_register(sc, adc_refresh, 5)) {
+ if (sensor_task_register(sc, adc_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/adm1021.c b/sys/dev/i2c/adm1021.c
index b8f44afe0d9..e49e67b1215 100644
--- a/sys/dev/i2c/adm1021.c
+++ b/sys/dev/i2c/adm1021.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adm1021.c,v 1.26 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: adm1021.c,v 1.27 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -151,7 +151,7 @@ admtemp_attach(struct device *parent, struct device *self, void *aux)
xeon ? "Xeon" : "Internal",
sizeof(sc->sc_sensor[ADMTEMP_INT].desc));
- if (sensor_task_register(sc, admtemp_refresh, 5)) {
+ if (sensor_task_register(sc, admtemp_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/adm1024.c b/sys/dev/i2c/adm1024.c
index 630cc3cdec6..e826660e4b5 100644
--- a/sys/dev/i2c/adm1024.c
+++ b/sys/dev/i2c/adm1024.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adm1024.c,v 1.13 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: adm1024.c,v 1.14 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -171,7 +171,7 @@ admlc_attach(struct device *parent, struct device *self, void *aux)
sc->sc_sensor[ADMLC_FAN2].type = SENSOR_FANRPM;
- if (sensor_task_register(sc, admlc_refresh, 5)) {
+ if (sensor_task_register(sc, admlc_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/adm1025.c b/sys/dev/i2c/adm1025.c
index 911c8398203..5a92ab081b7 100644
--- a/sys/dev/i2c/adm1025.c
+++ b/sys/dev/i2c/adm1025.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adm1025.c,v 1.24 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: adm1025.c,v 1.25 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -179,7 +179,7 @@ admtm_attach(struct device *parent, struct device *self, void *aux)
strlcpy(sc->sc_sensor[SMSC_TEMP2].desc, "External",
sizeof(sc->sc_sensor[SMSC_TEMP2].desc));
- if (sensor_task_register(sc, admtm_refresh, 5)) {
+ if (sensor_task_register(sc, admtm_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/adm1026.c b/sys/dev/i2c/adm1026.c
index 26cea62b63e..4b5deeb0534 100644
--- a/sys/dev/i2c/adm1026.c
+++ b/sys/dev/i2c/adm1026.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adm1026.c,v 1.9 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: adm1026.c,v 1.10 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -213,7 +213,7 @@ admcts_attach(struct device *parent, struct device *self, void *aux)
sc->sc_sensor[ADMCTS_FAN6].type = SENSOR_FANRPM;
sc->sc_sensor[ADMCTS_FAN7].type = SENSOR_FANRPM;
- if (sensor_task_register(sc, admcts_refresh, 5)) {
+ if (sensor_task_register(sc, admcts_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/adm1030.c b/sys/dev/i2c/adm1030.c
index 3e8f9ee7aca..cbabb569097 100644
--- a/sys/dev/i2c/adm1030.c
+++ b/sys/dev/i2c/adm1030.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adm1030.c,v 1.7 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: adm1030.c,v 1.8 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -102,7 +102,7 @@ admtmp_attach(struct device *parent, struct device *self, void *aux)
sc->sc_sensor[ADMTMP_FAN].type = SENSOR_FANRPM;
- if (sensor_task_register(sc, admtmp_refresh, 5)) {
+ if (sensor_task_register(sc, admtmp_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/adm1031.c b/sys/dev/i2c/adm1031.c
index cdbc443e71d..0bf9dd54af3 100644
--- a/sys/dev/i2c/adm1031.c
+++ b/sys/dev/i2c/adm1031.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adm1031.c,v 1.7 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: adm1031.c,v 1.8 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -112,7 +112,7 @@ admtt_attach(struct device *parent, struct device *self, void *aux)
sc->sc_sensor[ADMTT_FAN2].type = SENSOR_FANRPM;
- if (sensor_task_register(sc, admtt_refresh, 5)) {
+ if (sensor_task_register(sc, admtt_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/adt7460.c b/sys/dev/i2c/adt7460.c
index 52d2ce85247..afaeac888a8 100644
--- a/sys/dev/i2c/adt7460.c
+++ b/sys/dev/i2c/adt7460.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: adt7460.c,v 1.17 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: adt7460.c,v 1.18 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -231,7 +231,7 @@ adt_attach(struct device *parent, struct device *self, void *aux)
sc->sc_sensor[ADT_TACH3].type = SENSOR_FANRPM;
sc->sc_sensor[ADT_TACH4].type = SENSOR_FANRPM;
- if (sensor_task_register(sc, adt_refresh, 5)) {
+ if (sensor_task_register(sc, adt_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/asb100.c b/sys/dev/i2c/asb100.c
index 43759eab6dc..37961c82ece 100644
--- a/sys/dev/i2c/asb100.c
+++ b/sys/dev/i2c/asb100.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: asb100.c,v 1.9 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: asb100.c,v 1.10 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Damien Miller <djm@openbsd.org>
@@ -258,7 +258,7 @@ asbtm_attach(struct device *parent, struct device *self, void *aux)
strlcpy(sc->sc_sensor[ASB100_SENSOR_TEMP3].desc, "External",
sizeof(sc->sc_sensor[ASB100_SENSOR_TEMP3].desc));
- if (sensor_task_register(sc, asbtm_refresh, 5)) {
+ if (sensor_task_register(sc, asbtm_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/ds1631.c b/sys/dev/i2c/ds1631.c
index 0eeb55f8b8b..c0a911dcff3 100644
--- a/sys/dev/i2c/ds1631.c
+++ b/sys/dev/i2c/ds1631.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ds1631.c,v 1.8 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: ds1631.c,v 1.9 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -120,7 +120,7 @@ dostart:
strlcpy(sc->sc_sensor[MAXDS_TEMP].desc, "Internal",
sizeof(sc->sc_sensor[MAXDS_TEMP].desc));
- if (sensor_task_register(sc, maxds_refresh, 5)) {
+ if (sensor_task_register(sc, maxds_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/fcu.c b/sys/dev/i2c/fcu.c
index ea2ec733291..3d93aa5649f 100644
--- a/sys/dev/i2c/fcu.c
+++ b/sys/dev/i2c/fcu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fcu.c,v 1.6 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: fcu.c,v 1.7 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -98,7 +98,7 @@ fcu_attach(struct device *parent, struct device *self, void *aux)
sizeof(sc->sc_sensor[FCU_PWM1 + i].desc));
}
- if (sensor_task_register(sc, fcu_refresh, 5)) {
+ if (sensor_task_register(sc, fcu_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/fintek.c b/sys/dev/i2c/fintek.c
index 7ad803d5ebb..2fb24d0fe4c 100644
--- a/sys/dev/i2c/fintek.c
+++ b/sys/dev/i2c/fintek.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fintek.c,v 1.5 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: fintek.c,v 1.6 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2006 Dale Rahn <drahn@openbsd.org>
*
@@ -155,7 +155,7 @@ fintek_attach(struct device *parent, struct device *self, void *aux)
sc->sc_sensor[F_FAN1].type = SENSOR_FANRPM;
sc->sc_sensor[F_FAN2].type = SENSOR_FANRPM;
- if (sensor_task_register(sc, fintek_refresh, 5)) {
+ if (sensor_task_register(sc, fintek_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/gl518sm.c b/sys/dev/i2c/gl518sm.c
index d92cccab043..d1c00429014 100644
--- a/sys/dev/i2c/gl518sm.c
+++ b/sys/dev/i2c/gl518sm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gl518sm.c,v 1.5 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: gl518sm.c,v 1.6 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2006 Mark Kettenis
@@ -155,7 +155,7 @@ glenv_attach(struct device *parent, struct device *self, void *aux)
if (sc->sc_fan2_div == -1)
sc->sc_sensor[GLENV_FAN2].flags |= SENSOR_FINVALID;
- if (sensor_task_register(sc, glenv_refresh, 5)) {
+ if (sensor_task_register(sc, glenv_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/lm87.c b/sys/dev/i2c/lm87.c
index 038b7d50961..1ecf04d2c7a 100644
--- a/sys/dev/i2c/lm87.c
+++ b/sys/dev/i2c/lm87.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lm87.c,v 1.18 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: lm87.c,v 1.19 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -223,7 +223,7 @@ lmenv_attach(struct device *parent, struct device *self, void *aux)
sc->sc_sensor[LMENV_FAN2].type = SENSOR_FANRPM;
}
- if (sensor_task_register(sc, lmenv_refresh, 5)) {
+ if (sensor_task_register(sc, lmenv_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/maxim6690.c b/sys/dev/i2c/maxim6690.c
index f8448595d13..085aaff18cc 100644
--- a/sys/dev/i2c/maxim6690.c
+++ b/sys/dev/i2c/maxim6690.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: maxim6690.c,v 1.14 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: maxim6690.c,v 1.15 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -132,7 +132,7 @@ maxtmp_attach(struct device *parent, struct device *self, void *aux)
strlcpy(sc->sc_sensor[MAXTMP_EXT].desc, "External",
sizeof(sc->sc_sensor[MAXTMP_EXT].desc));
- if (sensor_task_register(sc, maxtmp_refresh, 5)) {
+ if (sensor_task_register(sc, maxtmp_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/pca9554.c b/sys/dev/i2c/pca9554.c
index dae1db08d55..473c3563f65 100644
--- a/sys/dev/i2c/pca9554.c
+++ b/sys/dev/i2c/pca9554.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pca9554.c,v 1.10 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: pca9554.c,v 1.11 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Theo de Raadt
@@ -129,7 +129,7 @@ pcagpio_attach(struct device *parent, struct device *self, void *aux)
}
- if (sensor_task_register(sc, pcagpio_refresh, 5)) {
+ if (sensor_task_register(sc, pcagpio_refresh, 5) == NULL) {
printf(", unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/tsl2560.c b/sys/dev/i2c/tsl2560.c
index 967981acfd9..d5a5665c5b5 100644
--- a/sys/dev/i2c/tsl2560.c
+++ b/sys/dev/i2c/tsl2560.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tsl2560.c,v 1.5 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: tsl2560.c,v 1.6 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis
@@ -120,7 +120,7 @@ tsl_attach(struct device *parent, struct device *self, void *aux)
sizeof(sc->sc_sensordev.xname));
sc->sc_sensor.type = SENSOR_LUX;
- if (sensor_task_register(sc, tsl_refresh, 5)) {
+ if (sensor_task_register(sc, tsl_refresh, 5) == NULL) {
printf(": unable to register update task\n");
return;
}
diff --git a/sys/dev/i2c/w83l784r.c b/sys/dev/i2c/w83l784r.c
index 9795bab4aef..0b33f8a432e 100644
--- a/sys/dev/i2c/w83l784r.c
+++ b/sys/dev/i2c/w83l784r.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: w83l784r.c,v 1.11 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: w83l784r.c,v 1.12 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2006 Mark Kettenis
@@ -219,7 +219,7 @@ wbenv_attach(struct device *parent, struct device *self, void *aux)
iic_ignore_addr(sc->sc_addr[2]);
start:
- if (sensor_task_register(sc, wbenv_refresh, 5)) {
+ if (sensor_task_register(sc, wbenv_refresh, 5) == NULL) {
printf("%s: unable to register update task\n",
sc->sc_dev.dv_xname);
return;
diff --git a/sys/dev/ic/ami.c b/sys/dev/ic/ami.c
index a4f558d30a0..d1a46b97a5d 100644
--- a/sys/dev/ic/ami.c
+++ b/sys/dev/ic/ami.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ami.c,v 1.183 2007/05/31 18:39:03 dlg Exp $ */
+/* $OpenBSD: ami.c,v 1.184 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2001 Michael Shalayeff
@@ -2474,7 +2474,7 @@ ami_create_sensors(struct ami_softc *sc)
if (sc->sc_bd == NULL)
goto bad;
- if (sensor_task_register(sc, ami_refresh_sensors, 10) != 0)
+ if (sensor_task_register(sc, ami_refresh_sensors, 10) == NULL)
goto freebd;
sensordev_install(&sc->sc_sensordev);
diff --git a/sys/dev/ic/ciss.c b/sys/dev/ic/ciss.c
index bb229a41e76..260872fc2ba 100644
--- a/sys/dev/ic/ciss.c
+++ b/sys/dev/ic/ciss.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ciss.c,v 1.26 2007/05/29 22:17:50 todd Exp $ */
+/* $OpenBSD: ciss.c,v 1.27 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005,2006 Michael Shalayeff
@@ -438,7 +438,7 @@ ciss_attach(struct ciss_softc *sc)
scsibus->sc_link[i][0]->device_softc)->dv_xname,
sizeof(sc->sc_lds[i]->xname));
}
- if (sensor_task_register(sc, ciss_sensors, 10))
+ if (sensor_task_register(sc, ciss_sensors, 10) == NULL)
free(sc->sensors, M_DEVBUF);
else
sensordev_install(&sc->sensordev);
diff --git a/sys/dev/ic/lm78.c b/sys/dev/ic/lm78.c
index b55567be46e..7323beecb52 100644
--- a/sys/dev/ic/lm78.c
+++ b/sys/dev/ic/lm78.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lm78.c,v 1.18 2007/05/26 22:47:39 cnst Exp $ */
+/* $OpenBSD: lm78.c,v 1.19 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005, 2006 Mark Kettenis
@@ -399,7 +399,8 @@ lm_attach(struct lm_softc *sc)
if (sc->numsensors == 0)
return;
- if (sensor_task_register(sc, lm_refresh, 5)) {
+ sc->sensortask = sensor_task_register(sc, lm_refresh, 5);
+ if (sc->sensortask == NULL) {
printf("%s: unable to register update task\n",
sc->sc_dev.dv_xname);
return;
@@ -425,7 +426,8 @@ lm_detach(struct lm_softc *sc)
for (i = 0; i < sc->numsensors; i++)
sensor_detach(&sc->sensordev, &sc->sensors[i]);
- sensor_task_unregister(sc);
+ if (sc->sensortask != NULL)
+ sensor_task_unregister(sc->sensortask);
return 0;
}
diff --git a/sys/dev/ic/lm78var.h b/sys/dev/ic/lm78var.h
index 6ea9697e843..7ab9437bd16 100644
--- a/sys/dev/ic/lm78var.h
+++ b/sys/dev/ic/lm78var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lm78var.h,v 1.12 2007/05/25 02:26:43 cnst Exp $ */
+/* $OpenBSD: lm78var.h,v 1.13 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005, 2006 Mark Kettenis
@@ -140,6 +140,7 @@ struct lm_softc {
struct ksensor sensors[WB_MAX_SENSORS];
struct ksensordev sensordev;
+ struct sensor_task *sensortask;
struct lm_sensor *lm_sensors;
u_int numsensors;
void (*refresh_sensor_data) (struct lm_softc *);
diff --git a/sys/dev/ic/mfi.c b/sys/dev/ic/mfi.c
index 0ed0ee857b9..05c404bdca1 100644
--- a/sys/dev/ic/mfi.c
+++ b/sys/dev/ic/mfi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mfi.c,v 1.72 2007/05/29 22:17:50 todd Exp $ */
+/* $OpenBSD: mfi.c,v 1.73 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@peereboom.us>
*
@@ -1817,7 +1817,7 @@ mfi_create_sensors(struct mfi_softc *sc)
sensor_attach(&sc->sc_sensordev, &sc->sc_sensors[i]);
}
- if (sensor_task_register(sc, mfi_refresh_sensors, 10) != 0)
+ if (sensor_task_register(sc, mfi_refresh_sensors, 10) == NULL)
goto bad;
sensordev_install(&sc->sc_sensordev);
diff --git a/sys/dev/isa/it.c b/sys/dev/isa/it.c
index 63583a3ddbf..79c51ac1baa 100644
--- a/sys/dev/isa/it.c
+++ b/sys/dev/isa/it.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: it.c,v 1.22 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: it.c,v 1.23 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2003 Julien Bordet <zejames@greyhats.org>
@@ -155,7 +155,7 @@ it_attach(struct device *parent, struct device *self, void *aux)
it_setup_volt(sc, 3, 9);
it_setup_temp(sc, 12, 3);
- if (sensor_task_register(sc, it_refresh, 5)) {
+ if (sensor_task_register(sc, it_refresh, 5) == NULL) {
printf("%s: unable to register update task\n",
sc->sc_dev.dv_xname);
return;
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);
diff --git a/sys/dev/pci/arc.c b/sys/dev/pci/arc.c
index a651bc44365..bb349144315 100644
--- a/sys/dev/pci/arc.c
+++ b/sys/dev/pci/arc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc.c,v 1.63 2007/05/29 22:17:50 todd Exp $ */
+/* $OpenBSD: arc.c,v 1.64 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -1564,7 +1564,7 @@ arc_create_sensors(void *xsc, void *arg)
sensor_attach(&sc->sc_sensordev, &sc->sc_sensors[i]);
}
- if (sensor_task_register(sc, arc_refresh_sensors, 120) != 0)
+ if (sensor_task_register(sc, arc_refresh_sensors, 120) == NULL)
goto bad;
sensordev_install(&sc->sc_sensordev);
diff --git a/sys/dev/softraid.c b/sys/dev/softraid.c
index a169e83f7b0..4f16fcaf6e3 100644
--- a/sys/dev/softraid.c
+++ b/sys/dev/softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: softraid.c,v 1.81 2007/06/06 23:06:02 deraadt Exp $ */
+/* $OpenBSD: softraid.c,v 1.82 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2007 Marco Peereboom <marco@peereboom.us>
*
@@ -2362,7 +2362,7 @@ sr_create_sensors(struct sr_discipline *sd)
sensor_attach(&sd->sd_vol.sv_sensordev, &sd->sd_vol.sv_sensor);
if (sc->sc_sensors_running == 0) {
- if (sensor_task_register(sc, sr_refresh_sensors, 10) != 0)
+ if (sensor_task_register(sc, sr_refresh_sensors, 10) == NULL)
goto bad;
sc->sc_sensors_running = 1;
}
diff --git a/sys/kern/kern_sensors.c b/sys/kern/kern_sensors.c
index 798cd7789b5..54384ee0e0a 100644
--- a/sys/kern/kern_sensors.c
+++ b/sys/kern/kern_sensors.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sensors.c,v 1.19 2007/06/04 18:42:05 deraadt Exp $ */
+/* $OpenBSD: kern_sensors.c,v 1.20 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -18,37 +18,23 @@
*/
#include <sys/param.h>
+#include <sys/proc.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/malloc.h>
-#include <sys/kthread.h>
#include <sys/queue.h>
#include <sys/types.h>
-#include <sys/time.h>
#include <sys/device.h>
#include <sys/hotplug.h>
+#include <sys/timeout.h>
+#include <sys/workq.h>
#include <sys/sensors.h>
#include "hotplug.h"
int sensordev_count = 0;
-SLIST_HEAD(, ksensordev) sensordev_list = SLIST_HEAD_INITIALIZER(sensordev_list);
-
-struct sensor_task {
- void *arg;
- void (*func)(void *);
-
- int period;
- time_t nextrun;
- volatile int running;
- TAILQ_ENTRY(sensor_task) entry;
-};
-
-void sensor_task_create(void *);
-void sensor_task_thread(void *);
-void sensor_task_schedule(struct sensor_task *);
-
-TAILQ_HEAD(, sensor_task) tasklist = TAILQ_HEAD_INITIALIZER(tasklist);
+SLIST_HEAD(, ksensordev) sensordev_list =
+ SLIST_HEAD_INITIALIZER(sensordev_list);
void
sensordev_install(struct ksensordev *sensdev)
@@ -176,100 +162,98 @@ sensor_find(int dev, enum sensor_type type, int numt)
return (NULL);
}
-int
+struct sensor_task {
+ void (*func)(void *);
+ void *arg;
+
+ int period;
+ struct timeout timeout;
+ volatile enum {
+ ST_TICKING,
+ ST_WORKQ,
+ ST_RUNNING,
+ ST_DYING,
+ ST_DEAD
+ } state;
+};
+
+void sensor_task_tick(void *);
+void sensor_task_work(void *, void *);
+
+struct sensor_task *
sensor_task_register(void *arg, void (*func)(void *), int period)
{
- struct sensor_task *st;
+ struct sensor_task *st;
st = malloc(sizeof(struct sensor_task), M_DEVBUF, M_NOWAIT);
if (st == NULL)
- return (1);
+ return (NULL);
- st->arg = arg;
st->func = func;
+ st->arg = arg;
st->period = period;
+ timeout_set(&st->timeout, sensor_task_tick, st);
- st->running = 1;
+ sensor_task_tick(st);
- if (TAILQ_EMPTY(&tasklist))
- kthread_create_deferred(sensor_task_create, NULL);
-
- st->nextrun = 0;
- TAILQ_INSERT_HEAD(&tasklist, st, entry);
- wakeup(&tasklist);
-
- return (0);
+ return (st);
}
void
-sensor_task_unregister(void *arg)
+sensor_task_unregister(struct sensor_task *st)
{
- struct sensor_task *st;
-
- TAILQ_FOREACH(st, &tasklist, entry) {
- if (st->arg == arg)
- st->running = 0;
+ timeout_del(&st->timeout);
+
+ switch (st->state) {
+ case ST_TICKING:
+ free(st, M_DEVBUF);
+ break;
+
+ case ST_WORKQ:
+ st->state = ST_DYING;
+ break;
+
+ case ST_RUNNING:
+ st->state = ST_DYING;
+ while (st->state != ST_DEAD)
+ tsleep(st, 0, "stunr", 0);
+ break;
+ default:
+ panic("sensor_task_unregister: unexpected state %d",
+ st->state);
}
}
void
-sensor_task_create(void *arg)
-{
- if (kthread_create(sensor_task_thread, NULL, NULL, "sensors") != 0)
- panic("sensors kthread");
-}
-
-void
-sensor_task_thread(void *arg)
+sensor_task_tick(void *arg)
{
- struct sensor_task *st, *nst;
- time_t now;
-
- while (!TAILQ_EMPTY(&tasklist)) {
- while ((nst = TAILQ_FIRST(&tasklist))->nextrun >
- (now = time_uptime))
- tsleep(&tasklist, PWAIT, "timeout",
- (nst->nextrun - now) * hz);
+ struct sensor_task *st = arg;
- while ((st = nst) != NULL) {
- nst = TAILQ_NEXT(st, entry);
-
- if (st->nextrun > now)
- break;
+ /* try to schedule the task */
+ if (workq_add_task(NULL, 0, sensor_task_work, st, NULL) != 0)
+ timeout_add(&st->timeout, hz/2);
- /* take it out while we work on it */
- TAILQ_REMOVE(&tasklist, st, entry);
-
- if (!st->running) {
- free(st, M_DEVBUF);
- continue;
- }
-
- /* run the task */
- st->func(st->arg);
- /* stick it back in the tasklist */
- sensor_task_schedule(st);
- }
- }
-
- kthread_exit(0);
+ st->state = ST_WORKQ;
}
void
-sensor_task_schedule(struct sensor_task *st)
+sensor_task_work(void *xst, void *arg)
{
- struct sensor_task *cst;
-
- st->nextrun = time_uptime + st->period;
+ struct sensor_task *st = xst;
- TAILQ_FOREACH(cst, &tasklist, entry) {
- if (cst->nextrun > st->nextrun) {
- TAILQ_INSERT_BEFORE(cst, st, entry);
- return;
- }
+ if (st->state == ST_DYING) {
+ free(st, M_DEVBUF);
+ return;
}
- /* must be an empty list, or at the end of the list */
- TAILQ_INSERT_TAIL(&tasklist, st, entry);
-}
+ st->state = ST_RUNNING;
+ st->func(st->arg);
+ if (st->state == ST_DYING) {
+ st->state = ST_DEAD;
+ wakeup(st);
+ } else {
+ st->state = ST_TICKING;
+ timeout_add(&st->timeout, hz * st->period);
+ }
+}
diff --git a/sys/scsi/safte.c b/sys/scsi/safte.c
index db16edebfa2..df0464e5205 100644
--- a/sys/scsi/safte.c
+++ b/sys/scsi/safte.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: safte.c,v 1.36 2007/06/01 22:58:50 cnst Exp $ */
+/* $OpenBSD: safte.c,v 1.37 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -72,6 +72,7 @@ struct safte_softc {
int sc_nsensors;
struct safte_sensor *sc_sensors;
struct ksensordev sc_sensordev;
+ struct sensor_task *sc_sensortask;
int sc_celsius;
int sc_ntemps;
@@ -180,16 +181,20 @@ safte_attach(struct device *parent, struct device *self, void *aux)
return;
}
- if (sc->sc_nsensors > 0 &&
- sensor_task_register(sc, safte_read_encstat, 10) != 0) {
- printf("%s: unable to register update task\n", DEVNAME(sc));
- sc->sc_nsensors = sc->sc_ntemps = 0;
- free(sc->sc_sensors, M_DEVBUF);
- } else {
- for (i = 0; i < sc->sc_nsensors; i++)
- sensor_attach(&sc->sc_sensordev,
- &sc->sc_sensors[i].se_sensor);
- sensordev_install(&sc->sc_sensordev);
+ if (sc->sc_nsensors > 0) {
+ sc->sc_sensortask = sensor_task_register(sc,
+ safte_read_encstat, 10);
+ if (sc->sc_sensortask == NULL) {
+ printf("%s: unable to register update task\n",
+ DEVNAME(sc));
+ sc->sc_nsensors = sc->sc_ntemps = 0;
+ free(sc->sc_sensors, M_DEVBUF);
+ } else {
+ for (i = 0; i < sc->sc_nsensors; i++)
+ sensor_attach(&sc->sc_sensordev,
+ &sc->sc_sensors[i].se_sensor);
+ sensordev_install(&sc->sc_sensordev);
+ }
}
#if NBIO > 0
@@ -224,7 +229,7 @@ safte_detach(struct device *self, int flags)
if (sc->sc_nsensors > 0) {
sensordev_deinstall(&sc->sc_sensordev);
- sensor_task_unregister(sc);
+ sensor_task_unregister(sc->sc_sensortask);
for (i = 0; i < sc->sc_nsensors; i++)
sensor_detach(&sc->sc_sensordev,
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);
diff --git a/sys/sys/sensors.h b/sys/sys/sensors.h
index 411027ecaa2..94fb67c640b 100644
--- a/sys/sys/sensors.h
+++ b/sys/sys/sensors.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sensors.h,v 1.23 2007/03/22 16:55:31 deraadt Exp $ */
+/* $OpenBSD: sensors.h,v 1.24 2007/06/24 05:34:35 dlg Exp $ */
/*
* Copyright (c) 2003, 2004 Alexander Yurchenko <grange@openbsd.org>
@@ -153,8 +153,9 @@ void sensor_detach(struct ksensordev *, struct ksensor *);
struct ksensor *sensor_find(int, enum sensor_type, int);
/* task scheduling */
-int sensor_task_register(void *, void (*)(void *), int);
-void sensor_task_unregister(void *);
+struct sensor_task;
+struct sensor_task *sensor_task_register(void *, void (*)(void *), int);
+void sensor_task_unregister(struct sensor_task *);
#endif /* _KERNEL */