diff options
author | Alexander Yurchenko <grange@cvs.openbsd.org> | 2004-01-12 14:10:54 +0000 |
---|---|---|
committer | Alexander Yurchenko <grange@cvs.openbsd.org> | 2004-01-12 14:10:54 +0000 |
commit | 4d3833f5b8ffd7244b58e51867ebf26a8e1146ed (patch) | |
tree | 59b593e986bc722687ef951ee1aa2b616f44f854 /sys/dev | |
parent | 1b90e602977493019983f46c9113241a59e7cc59 (diff) |
Move sensors externs to sys/sensors.h and introduce a macro
SENSOR_ADD to hide all operations with these externs.
ok markus@
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/ic/nslm7x.c | 7 | ||||
-rw-r--r-- | sys/dev/isa/it.c | 7 | ||||
-rw-r--r-- | sys/dev/isa/nsclpcsio_isa.c | 8 | ||||
-rw-r--r-- | sys/dev/pci/viaenv.c | 7 |
4 files changed, 8 insertions, 21 deletions
diff --git a/sys/dev/ic/nslm7x.c b/sys/dev/ic/nslm7x.c index 0aafacd79ba..fdceb302b34 100644 --- a/sys/dev/ic/nslm7x.c +++ b/sys/dev/ic/nslm7x.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nslm7x.c,v 1.3 2003/08/05 13:42:36 couderc Exp $ */ +/* $OpenBSD: nslm7x.c,v 1.4 2004/01/12 14:10:53 grange Exp $ */ /* $NetBSD: nslm7x.c,v 1.17 2002/11/15 14:55:41 ad Exp $ */ /*- @@ -151,8 +151,6 @@ void lm_attach(struct lm_softc *lmsc) { u_int i; - extern int nsensors; - extern struct sensors_head sensors; /* Install default bank selection routine, if none given. */ if (lmsc->lm_banksel == NULL) @@ -169,8 +167,7 @@ lm_attach(struct lm_softc *lmsc) for (i = 0; i < lmsc->numsensors; ++i) { strlcpy(lmsc->sensors[i].device, lmsc->sc_dev.dv_xname, sizeof(lmsc->sensors[i].device)); - lmsc->sensors[i].num = nsensors++; - SLIST_INSERT_HEAD(&sensors, &lmsc->sensors[i], list); + SENSOR_ADD(&lmsc->sensors[i]); } /* Refresh sensors data every 1.5 seconds */ diff --git a/sys/dev/isa/it.c b/sys/dev/isa/it.c index 2997649bfcd..21093327eac 100644 --- a/sys/dev/isa/it.c +++ b/sys/dev/isa/it.c @@ -1,4 +1,4 @@ -/* $OpenBSD: it.c,v 1.4 2003/11/05 20:57:10 grange Exp $ */ +/* $OpenBSD: it.c,v 1.5 2004/01/12 14:10:53 grange Exp $ */ /* * Copyright (c) 2003 Julien Bordet <zejames@greyhats.org> @@ -122,8 +122,6 @@ it_attach(struct device *parent, struct device *self, void *aux) struct isa_attach_args *ia = aux; int i; u_int8_t cr; - extern int nsensors; - extern struct sensors_head sensors; iobase = ia->ipa_io[0].base; iot = sc->it_iot = ia->ia_iot; @@ -161,8 +159,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)); - sc->sensors[i].num = nsensors++; - SLIST_INSERT_HEAD(&sensors, &sc->sensors[i], list); + SENSOR_ADD(&sc->sensors[i]); } timeout_set(&it_timeout, it_refresh, sc); diff --git a/sys/dev/isa/nsclpcsio_isa.c b/sys/dev/isa/nsclpcsio_isa.c index 710ce8b8a36..43cd6a54ba0 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.1 2004/01/05 17:27:29 markus Exp $ */ +/* $OpenBSD: nsclpcsio_isa.c,v 1.2 2004/01/12 14:10:53 grange Exp $ */ /* $NetBSD: nsclpcsio_isa.c,v 1.5 2002/10/22 16:18:26 drochner Exp $ */ /* @@ -226,9 +226,6 @@ nsclpcsio_isa_attach(parent, self, aux) int iobase; int i; - extern int nsensors; - extern struct sensors_head sensors; - iobase = ia->ipa_io[0].base; sc->sc_iot = iot = ia->ia_iot; if (bus_space_map(ia->ia_iot, iobase, 2, 0, &sc->sc_ioh)) { @@ -250,8 +247,7 @@ nsclpcsio_isa_attach(parent, self, aux) continue; strlcpy(sc->sensors[i].device, sc->sc_dev.dv_xname, sizeof(sc->sensors[i].device)); - sc->sensors[i].num = nsensors++; - SLIST_INSERT_HEAD(&sensors, &sc->sensors[i], list); + SENSOR_ADD(&sc->sensors[i]); } if (sc->sc_tms || sc->sc_vlm) { timeout_set(&nsclpcsio_timeout, nsclpcsio_refresh, sc); diff --git a/sys/dev/pci/viaenv.c b/sys/dev/pci/viaenv.c index 76498c84256..301673057a4 100644 --- a/sys/dev/pci/viaenv.c +++ b/sys/dev/pci/viaenv.c @@ -1,4 +1,4 @@ -/* $OpenBSD: viaenv.c,v 1.2 2003/10/16 18:38:40 grange Exp $ */ +/* $OpenBSD: viaenv.c,v 1.3 2004/01/12 14:10:53 grange Exp $ */ /* $NetBSD: viaenv.c,v 1.9 2002/10/02 16:51:59 thorpej Exp $ */ /* @@ -246,8 +246,6 @@ viaenv_attach(struct device * parent, struct device * self, void *aux) struct pci_attach_args *pa = aux; pcireg_t iobase, control; int i; - extern int nsensors; - extern struct sensors_head sensors; iobase = pci_conf_read(pa->pa_pc, pa->pa_tag, 0x70); control = pci_conf_read(pa->pa_pc, pa->pa_tag, 0x74); @@ -266,8 +264,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)); - sc->sc_data[i].num = nsensors++; - SLIST_INSERT_HEAD(&sensors, &sc->sc_data[i], list); + SENSOR_ADD(&sc->sc_data[i]); } for (i = 0; i <= 2; i++) { |