diff options
Diffstat (limited to 'sys')
32 files changed, 102 insertions, 73 deletions
diff --git a/sys/arch/i386/i386/esm.c b/sys/arch/i386/i386/esm.c index 3ca30d0d09f..f7c9186b994 100644 --- a/sys/arch/i386/i386/esm.c +++ b/sys/arch/i386/i386/esm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: esm.c,v 1.32 2006/01/05 07:39:30 dlg Exp $ */ +/* $OpenBSD: esm.c,v 1.33 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org> @@ -919,7 +919,7 @@ esm_make_sensors(struct esm_softc *sc, struct esm_devmap *devmap, for (j = 0; j < nsensors; j++) { s[j].type = esm_typemap[es->es_type]; strlcpy(s[j].device, DEVNAME(sc), sizeof(s[j].device)); - SENSOR_ADD(&s[j]); + sensor_add(&s[j]); } es->es_sensor = s; diff --git a/sys/arch/macppc/dev/asms.c b/sys/arch/macppc/dev/asms.c index 157f0a0bdb3..17724436754 100644 --- a/sys/arch/macppc/dev/asms.c +++ b/sys/arch/macppc/dev/asms.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asms.c,v 1.2 2006/01/06 08:18:17 xsa Exp $ */ +/* $OpenBSD: asms.c,v 1.3 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Xavier Santolaria <xsa@openbsd.org> * @@ -269,7 +269,7 @@ 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_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/arch/macppc/dev/smu.c b/sys/arch/macppc/dev/smu.c index 70e7edc67d9..c0e510635a7 100644 --- a/sys/arch/macppc/dev/smu.c +++ b/sys/arch/macppc/dev/smu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smu.c,v 1.10 2006/01/01 20:52:25 deraadt Exp $ */ +/* $OpenBSD: smu.c,v 1.11 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -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_add(&fan->sensor); } /* Sensors */ @@ -321,7 +321,7 @@ 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_add(&sensor->sensor); } /* CPU temperature diode calibration */ diff --git a/sys/dev/i2c/ad741x.c b/sys/dev/i2c/ad741x.c index a6748d9edb0..6cb5106f019 100644 --- a/sys/dev/i2c/ad741x.c +++ b/sys/dev/i2c/ad741x.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ad741x.c,v 1.6 2005/12/31 04:31:27 deraadt Exp $ */ +/* $OpenBSD: ad741x.c,v 1.7 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Theo de Raadt @@ -152,12 +152,12 @@ adc_attach(struct device *parent, struct device *self, void *aux) return; } - SENSOR_ADD(&sc->sc_sensor[0]); + sensor_add(&sc->sc_sensor[0]); if (sc->sc_chip == 7417 || sc->sc_chip == 7418) - SENSOR_ADD(&sc->sc_sensor[1]); + sensor_add(&sc->sc_sensor[1]); if (sc->sc_chip == 7417) for (i = 2; i < nsens; i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/dev/i2c/adm1021.c b/sys/dev/i2c/adm1021.c index 45a5149e56b..f5541ae0ba6 100644 --- a/sys/dev/i2c/adm1021.c +++ b/sys/dev/i2c/adm1021.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adm1021.c,v 1.20 2006/01/03 07:55:47 kettenis Exp $ */ +/* $OpenBSD: adm1021.c,v 1.21 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Theo de Raadt @@ -153,7 +153,7 @@ admtemp_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < (sc->sc_noexternal ? 1 : ADMTEMP_NUM_SENSORS); i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/dev/i2c/adm1024.c b/sys/dev/i2c/adm1024.c index 8a72ff2e529..fb43c6b56ac 100644 --- a/sys/dev/i2c/adm1024.c +++ b/sys/dev/i2c/adm1024.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adm1024.c,v 1.9 2005/12/31 04:31:27 deraadt Exp $ */ +/* $OpenBSD: adm1024.c,v 1.10 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Theo de Raadt @@ -181,7 +181,7 @@ admlc_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < ADMLC_NUM_SENSORS; i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/dev/i2c/adm1025.c b/sys/dev/i2c/adm1025.c index 96d1b138e53..81fb2b172d3 100644 --- a/sys/dev/i2c/adm1025.c +++ b/sys/dev/i2c/adm1025.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adm1025.c,v 1.20 2006/01/06 03:44:35 deraadt Exp $ */ +/* $OpenBSD: adm1025.c,v 1.21 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Theo de Raadt @@ -185,7 +185,7 @@ admtm_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < sc->sc_nsensors; i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/dev/i2c/adm1026.c b/sys/dev/i2c/adm1026.c index 1e2478e68e4..d356794231e 100644 --- a/sys/dev/i2c/adm1026.c +++ b/sys/dev/i2c/adm1026.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adm1026.c,v 1.5 2005/12/31 04:31:27 deraadt Exp $ */ +/* $OpenBSD: adm1026.c,v 1.6 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Theo de Raadt @@ -243,7 +243,7 @@ admcts_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < ADMCTS_NUM_SENSORS; i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/dev/i2c/adm1030.c b/sys/dev/i2c/adm1030.c index 593fbae3c67..dba434b18e3 100644 --- a/sys/dev/i2c/adm1030.c +++ b/sys/dev/i2c/adm1030.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adm1030.c,v 1.3 2005/12/27 17:18:18 deraadt Exp $ */ +/* $OpenBSD: adm1030.c,v 1.4 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Theo de Raadt @@ -110,7 +110,7 @@ admtmp_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < ADMTMP_NUM_SENSORS; i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/dev/i2c/adm1031.c b/sys/dev/i2c/adm1031.c index d5f3975ad93..2beb7bd3b78 100644 --- a/sys/dev/i2c/adm1031.c +++ b/sys/dev/i2c/adm1031.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adm1031.c,v 1.3 2005/12/28 20:35:24 deraadt Exp $ */ +/* $OpenBSD: adm1031.c,v 1.4 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Theo de Raadt @@ -122,7 +122,7 @@ admtt_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < ADMTT_NUM_SENSORS; i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/dev/i2c/adt7460.c b/sys/dev/i2c/adt7460.c index 11aeaafc0f5..248c05a4db9 100644 --- a/sys/dev/i2c/adt7460.c +++ b/sys/dev/i2c/adt7460.c @@ -1,4 +1,4 @@ -/* $OpenBSD: adt7460.c,v 1.5 2005/12/28 00:42:14 deraadt Exp $ */ +/* $OpenBSD: adt7460.c,v 1.6 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -178,7 +178,7 @@ adt_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < ADT_NUM_SENSORS; i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/dev/i2c/asb100.c b/sys/dev/i2c/asb100.c index 4dc9d8f0792..9205ee6a517 100644 --- a/sys/dev/i2c/asb100.c +++ b/sys/dev/i2c/asb100.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asb100.c,v 1.3 2006/01/01 22:27:46 djm Exp $ */ +/* $OpenBSD: asb100.c,v 1.4 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Damien Miller @@ -292,7 +292,7 @@ asbtm_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < ASB100_NUM_SENSORS; i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/dev/i2c/ds1631.c b/sys/dev/i2c/ds1631.c index 13bcc30d9e8..2eb38c59d18 100644 --- a/sys/dev/i2c/ds1631.c +++ b/sys/dev/i2c/ds1631.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ds1631.c,v 1.4 2006/01/13 21:41:40 deraadt Exp $ */ +/* $OpenBSD: ds1631.c,v 1.5 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Theo de Raadt @@ -126,7 +126,7 @@ dostart: } for (i = 0; i < MAXDS_NUM_SENSORS; i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/dev/i2c/fcu.c b/sys/dev/i2c/fcu.c index e2a01910d7a..13a0413aa18 100644 --- a/sys/dev/i2c/fcu.c +++ b/sys/dev/i2c/fcu.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fcu.c,v 1.2 2005/12/27 17:18:18 deraadt Exp $ */ +/* $OpenBSD: fcu.c,v 1.3 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -108,7 +108,7 @@ fcu_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < FCU_NUM_SENSORS; i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/dev/i2c/lm75.c b/sys/dev/i2c/lm75.c index 9a9d054d720..caf0ea97a77 100644 --- a/sys/dev/i2c/lm75.c +++ b/sys/dev/i2c/lm75.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lm75.c,v 1.10 2006/01/10 23:02:32 deraadt Exp $ */ +/* $OpenBSD: lm75.c,v 1.11 2006/01/19 17:08:39 grange Exp $ */ /* $NetBSD: lm75.c,v 1.1 2003/09/30 00:35:31 thorpej Exp $ */ /* * Copyright (c) 2006 Theo de Raadt <deraadt@openbsd.org> @@ -180,7 +180,7 @@ lmtemp_attach(struct device *parent, struct device *self, void *aux) strlcpy(sc->sc_sensor.desc, "TEMP", sizeof(sc->sc_sensor.desc)); /* Hook into the hw.sensors sysctl */ - SENSOR_ADD(&sc->sc_sensor); + sensor_add(&sc->sc_sensor); sensor_task_register(sc, lmtemp_refresh_sensor_data, LM_POLLTIME); } diff --git a/sys/dev/i2c/lm87.c b/sys/dev/i2c/lm87.c index 27026ef6dda..3a76ca5eaa1 100644 --- a/sys/dev/i2c/lm87.c +++ b/sys/dev/i2c/lm87.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lm87.c,v 1.14 2005/12/31 04:31:27 deraadt Exp $ */ +/* $OpenBSD: lm87.c,v 1.15 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -233,7 +233,7 @@ lmenv_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < LMENV_NUM_SENSORS; i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/dev/i2c/maxim6690.c b/sys/dev/i2c/maxim6690.c index 67a558b0ee9..5363693e7e9 100644 --- a/sys/dev/i2c/maxim6690.c +++ b/sys/dev/i2c/maxim6690.c @@ -1,4 +1,4 @@ -/* $OpenBSD: maxim6690.c,v 1.5 2005/12/31 04:31:27 deraadt Exp $ */ +/* $OpenBSD: maxim6690.c,v 1.6 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Theo de Raadt @@ -126,7 +126,7 @@ maxtmp_attach(struct device *parent, struct device *self, void *aux) } for (i = 0; i < MAXTMP_NUM_SENSORS; i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); printf("\n"); } diff --git a/sys/dev/i2c/pca9554.c b/sys/dev/i2c/pca9554.c index 48b336198ff..5cc443b2536 100644 --- a/sys/dev/i2c/pca9554.c +++ b/sys/dev/i2c/pca9554.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pca9554.c,v 1.6 2005/12/27 17:18:18 deraadt Exp $ */ +/* $OpenBSD: pca9554.c,v 1.7 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Theo de Raadt @@ -135,7 +135,7 @@ pcagpio_attach(struct device *parent, struct device *self, void *aux) #if 0 for (i = 0; i < PCAGPIO_NPINS; i++) - SENSOR_ADD(&sc->sc_sensor[i]); + sensor_add(&sc->sc_sensor[i]); #endif printf(":"); diff --git a/sys/dev/i2c/tsl2560.c b/sys/dev/i2c/tsl2560.c index 974dfbe30ca..28ea49cd4a9 100644 --- a/sys/dev/i2c/tsl2560.c +++ b/sys/dev/i2c/tsl2560.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsl2560.c,v 1.2 2005/12/27 17:18:18 deraadt Exp $ */ +/* $OpenBSD: tsl2560.c,v 1.3 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Mark Kettenis @@ -125,7 +125,7 @@ tsl_attach(struct device *parent, struct device *self, void *aux) return; } - SENSOR_ADD(&sc->sc_sensor); + sensor_add(&sc->sc_sensor); printf("\n"); } diff --git a/sys/dev/i2c/w83l784r.c b/sys/dev/i2c/w83l784r.c index d161504006e..48bca0c5a16 100644 --- a/sys/dev/i2c/w83l784r.c +++ b/sys/dev/i2c/w83l784r.c @@ -1,4 +1,4 @@ -/* $OpenBSD: w83l784r.c,v 1.1 2006/01/15 12:20:14 kettenis Exp $ */ +/* $OpenBSD: w83l784r.c,v 1.2 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2006 Mark Kettenis @@ -216,7 +216,7 @@ wbenv_attach(struct device *parent, struct device *self, void *aux) /* Add sensors */ for (i = 0; i < sc->sc_numsensors; ++i) - SENSOR_ADD(&sc->sc_sensors[i]); + sensor_add(&sc->sc_sensors[i]); } void diff --git a/sys/dev/ic/lm78.c b/sys/dev/ic/lm78.c index 300549eb715..ce2454c4eec 100644 --- a/sys/dev/ic/lm78.c +++ b/sys/dev/ic/lm78.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lm78.c,v 1.3 2006/01/17 22:01:48 kettenis Exp $ */ +/* $OpenBSD: lm78.c,v 1.4 2006/01/19 17:08:40 grange Exp $ */ /* * Copyright (c) 2005, 2006 Mark Kettenis @@ -331,7 +331,7 @@ lm_attach(struct lm_softc *sc) /* Add sensors */ for (i = 0; i < sc->numsensors; ++i) - SENSOR_ADD(&sc->sensors[i]); + sensor_add(&sc->sensors[i]); } int diff --git a/sys/dev/ipmi.c b/sys/dev/ipmi.c index 96aa9863de9..f82fdd3d3c5 100644 --- a/sys/dev/ipmi.c +++ b/sys/dev/ipmi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ipmi.c,v 1.32 2006/01/18 04:46:04 marco Exp $ */ +/* $OpenBSD: ipmi.c,v 1.33 2006/01/19 17:08:39 grange Exp $ */ /* * Copyright (c) 2005 Jordan Hargrave @@ -1551,7 +1551,7 @@ add_child_sensors(struct ipmi_softc *sc, u_int8_t *psdr, int count, psensor->i_sensor.desc); if (read_sensor(sc, psensor) == 0) { SLIST_INSERT_HEAD(&ipmi_sensor_list, psensor, list); - SENSOR_ADD(&psensor->i_sensor); + sensor_add(&psensor->i_sensor); dbg_printf(5, " reading: %lld [%s]\n", psensor->i_sensor.value, psensor->i_sensor.desc); diff --git a/sys/dev/isa/aps.c b/sys/dev/isa/aps.c index 688609ff826..26e621c0a75 100644 --- a/sys/dev/isa/aps.c +++ b/sys/dev/isa/aps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: aps.c,v 1.5 2005/08/28 03:52:37 djm Exp $ */ +/* $OpenBSD: aps.c,v 1.6 2006/01/19 17:08:40 grange Exp $ */ /* * Copyright (c) 2005 Jonathan Gray <jsg@openbsd.org> * @@ -200,7 +200,7 @@ aps_attach(struct device *parent, struct device *self, void *aux) for (i = 0; i < sc->numsensors; i++) { strlcpy(sc->sensors[i].device, sc->sc_dev.dv_xname, sizeof(sc->sensors[i].device)); - SENSOR_ADD(&sc->sensors[i]); + sensor_add(&sc->sensors[i]); } powerhook_establish(aps_power, (void *)sc); diff --git a/sys/dev/isa/it.c b/sys/dev/isa/it.c index 7957fc4d1ce..f3ecabdeb32 100644 --- a/sys/dev/isa/it.c +++ b/sys/dev/isa/it.c @@ -1,4 +1,4 @@ -/* $OpenBSD: it.c,v 1.16 2005/12/28 15:27:44 grange Exp $ */ +/* $OpenBSD: it.c,v 1.17 2006/01/19 17:08:40 grange Exp $ */ /* * Copyright (c) 2003 Julien Bordet <zejames@greyhats.org> @@ -148,7 +148,7 @@ it_attach(struct device *parent, struct device *self, void *aux) for (i = 0; i < sc->numsensors; ++i) { strlcpy(sc->sensors[i].device, sc->sc_dev.dv_xname, sizeof(sc->sensors[i].device)); - SENSOR_ADD(&sc->sensors[i]); + sensor_add(&sc->sensors[i]); } } diff --git a/sys/dev/isa/nsclpcsio_isa.c b/sys/dev/isa/nsclpcsio_isa.c index 13fbf064cae..1a61ff1da23 100644 --- a/sys/dev/isa/nsclpcsio_isa.c +++ b/sys/dev/isa/nsclpcsio_isa.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nsclpcsio_isa.c,v 1.6 2006/01/05 15:32:46 grange Exp $ */ +/* $OpenBSD: nsclpcsio_isa.c,v 1.7 2006/01/19 17:08:40 grange Exp $ */ /* $NetBSD: nsclpcsio_isa.c,v 1.5 2002/10/22 16:18:26 drochner Exp $ */ /* @@ -331,7 +331,7 @@ nsclpcsio_isa_attach(struct device *parent, struct device *self, void *aux) continue; strlcpy(sc->sensors[i].device, sc->sc_dev.dv_xname, sizeof(sc->sensors[i].device)); - SENSOR_ADD(&sc->sensors[i]); + sensor_add(&sc->sensors[i]); } if (sc->sc_ld_en[SIO_LDN_TMS] || sc->sc_ld_en[SIO_LDN_VLM]) { timeout_set(&nsclpcsio_timeout, nsclpcsio_refresh, sc); diff --git a/sys/dev/isa/viasio.c b/sys/dev/isa/viasio.c index 9a52544b2f7..fb04f69882e 100644 --- a/sys/dev/isa/viasio.c +++ b/sys/dev/isa/viasio.c @@ -1,4 +1,4 @@ -/* $OpenBSD: viasio.c,v 1.4 2005/10/08 14:57:27 grange Exp $ */ +/* $OpenBSD: viasio.c,v 1.5 2006/01/19 17:08:40 grange Exp $ */ /* * Copyright (c) 2005 Alexander Yurchenko <grange@openbsd.org> * @@ -320,7 +320,7 @@ viasio_hm_init(struct viasio_softc *sc) /* Start sensors */ for (i = 0; i < VT1211_HM_NSENSORS; i++) - SENSOR_ADD(&sc->sc_hm_sensors[i]); + sensor_add(&sc->sc_hm_sensors[i]); timeout_set(&sc->sc_hm_timo, viasio_hm_refresh, sc); timeout_add(&sc->sc_hm_timo, hz); } diff --git a/sys/dev/pci/viaenv.c b/sys/dev/pci/viaenv.c index ed165a2d004..1ca3fcc351e 100644 --- a/sys/dev/pci/viaenv.c +++ b/sys/dev/pci/viaenv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: viaenv.c,v 1.6 2004/10/05 19:03:58 grange Exp $ */ +/* $OpenBSD: viaenv.c,v 1.7 2006/01/19 17:08:40 grange Exp $ */ /* $NetBSD: viaenv.c,v 1.9 2002/10/02 16:51:59 thorpej Exp $ */ /* @@ -287,7 +287,7 @@ viaenv_attach(struct device * parent, struct device * self, void *aux) for (i = 0; i < VIANUMSENSORS; ++i) { strlcpy(sc->sc_data[i].device, sc->sc_dev.dv_xname, sizeof(sc->sc_data[i].device)); - SENSOR_ADD(&sc->sc_data[i]); + sensor_add(&sc->sc_data[i]); } for (i = 0; i <= 2; i++) { diff --git a/sys/kern/kern_sensors.c b/sys/kern/kern_sensors.c index 93e90daf5fe..2c2eeddbfaa 100644 --- a/sys/kern/kern_sensors.c +++ b/sys/kern/kern_sensors.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sensors.c,v 1.5 2005/11/21 13:47:52 dlg Exp $ */ +/* $OpenBSD: kern_sensors.c,v 1.6 2006/01/19 17:08:40 grange Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -46,6 +46,39 @@ void sensor_task_schedule(struct sensor_task *); TAILQ_HEAD(, sensor_task) tasklist = TAILQ_HEAD_INITIALIZER(tasklist); +void +sensor_add(struct sensor *sens) +{ + struct sensor *v, *nv; + int s; + + s = splhigh(); + if (_sensors_count == 0) { + sens->num = 0; + SLIST_INSERT_HEAD(&_sensors_list, sens, list); + } else { + for (v = SLIST_FIRST(&_sensors_list); + (nv = SLIST_NEXT(v, list)) != NULL; v = nv) + if (nv->num - v->num > 1) + break; + sens->num = v->num + 1; + SLIST_INSERT_AFTER(v, sens, list); + } + _sensors_count++; + splx(s); +} + +void +sensor_del(struct sensor *sens) +{ + int s; + + s = splhigh(); + _sensors_count--; + SLIST_REMOVE(&_sensors_list, sens, sensor, list); + splx(s); +} + int sensor_task_register(void *arg, void (*func)(void *), int period) { diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index c81437b56c1..516f1281964 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sysctl.c,v 1.136 2005/11/28 00:14:29 jsg Exp $ */ +/* $OpenBSD: kern_sysctl.c,v 1.137 2006/01/19 17:08:40 grange Exp $ */ /* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */ /*- @@ -1754,14 +1754,12 @@ sysctl_sensors(int *name, u_int namelen, void *oldp, size_t *oldlenp, return (ENOTDIR); num = name[0]; - if (num < 0 || num >= _sensors_count) - return (ENXIO); - SLIST_FOREACH(s, &_sensors_list, list) if (s->num == num) - break; + return (sysctl_rdstruct(oldp, oldlenp, newp, s, + sizeof(struct sensor))); - return (sysctl_rdstruct(oldp, oldlenp, newp, s, sizeof(struct sensor))); + return (ENOENT); } int diff --git a/sys/scsi/safte.c b/sys/scsi/safte.c index cc4c3a0e987..355069d2bd3 100644 --- a/sys/scsi/safte.c +++ b/sys/scsi/safte.c @@ -1,4 +1,4 @@ -/* $OpenBSD: safte.c,v 1.25 2006/01/11 08:21:21 dlg Exp $ */ +/* $OpenBSD: safte.c,v 1.26 2006/01/19 17:08:40 grange Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -185,7 +185,7 @@ safte_attach(struct device *parent, struct device *self, void *aux) free(sc->sc_sensors, M_DEVBUF); } else { for (i = 0; i < sc->sc_nsensors; i++) - SENSOR_ADD(&sc->sc_sensors[i].se_sensor); + sensor_add(&sc->sc_sensors[i].se_sensor); } #if NBIO > 0 diff --git a/sys/scsi/ses.c b/sys/scsi/ses.c index 1a1b222a162..3b495452da3 100644 --- a/sys/scsi/ses.c +++ b/sys/scsi/ses.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ses.c,v 1.33 2006/01/11 08:21:21 dlg Exp $ */ +/* $OpenBSD: ses.c,v 1.34 2006/01/19 17:08:40 grange Exp $ */ /* * Copyright (c) 2005 David Gwynne <dlg@openbsd.org> @@ -178,7 +178,7 @@ ses_attach(struct device *parent, struct device *self, void *aux) } } else { TAILQ_FOREACH(sensor, &sc->sc_sensors, se_entry) - SENSOR_ADD(&sensor->se_sensor); + sensor_add(&sensor->se_sensor); } #if NBIO > 0 diff --git a/sys/sys/sensors.h b/sys/sys/sensors.h index aaa8b678bb1..235ce797013 100644 --- a/sys/sys/sensors.h +++ b/sys/sys/sensors.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sensors.h,v 1.12 2005/11/30 15:46:32 dlg Exp $ */ +/* $OpenBSD: sensors.h,v 1.13 2006/01/19 17:08:40 grange Exp $ */ /* * Copyright (c) 2003, 2004 Alexander Yurchenko <grange@openbsd.org> @@ -87,10 +87,8 @@ SLIST_HEAD(sensors_head, sensor); extern int _sensors_count; extern struct sensors_head _sensors_list; -#define SENSOR_ADD(s) do { \ - (s)->num = _sensors_count++; \ - SLIST_INSERT_HEAD(&_sensors_list, (s), list); \ -} while (0) +void sensor_add(struct sensor *); +void sensor_del(struct sensor *); int sensor_task_register(void *, void (*)(void *), int); void sensor_task_unregister(void *); |