diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-07-26 18:43:37 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2011-07-26 18:43:37 +0000 |
commit | 062b0097478eaca2f34bf9b128b95a945310d7c8 (patch) | |
tree | 2ca9abaf85bab97314cf4561acb3e4d1a9cacc36 /sys/dev/ic | |
parent | e6fd3356ab661c4e7fecd8e64fb9e9fd29bd9001 (diff) |
Calling a detach function from an attach function is no longer legal (
see a recent subr_autoconf.c commit). To resolve this problem, mark the
other attachment dead, and clean it up when the first servicing timeout
gets run.
ok kettenis
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/lm78.c | 32 | ||||
-rw-r--r-- | sys/dev/ic/lm78var.h | 6 |
2 files changed, 19 insertions, 19 deletions
diff --git a/sys/dev/ic/lm78.c b/sys/dev/ic/lm78.c index 80911066fcd..0a84be19fc6 100644 --- a/sys/dev/ic/lm78.c +++ b/sys/dev/ic/lm78.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lm78.c,v 1.20 2007/06/25 22:50:18 cnst Exp $ */ +/* $OpenBSD: lm78.c,v 1.21 2011/07/26 18:43:35 deraadt Exp $ */ /* * Copyright (c) 2005, 2006 Mark Kettenis @@ -417,22 +417,6 @@ lm_attach(struct lm_softc *sc) } int -lm_detach(struct lm_softc *sc) -{ - int i; - - /* Remove sensors */ - sensordev_deinstall(&sc->sensordev); - for (i = 0; i < sc->numsensors; i++) - sensor_detach(&sc->sensordev, &sc->sensors[i]); - - if (sc->sensortask != NULL) - sensor_task_unregister(sc->sensortask); - - return 0; -} - -int lm_match(struct lm_softc *sc) { int chipid; @@ -599,6 +583,20 @@ lm_refresh(void *arg) { struct lm_softc *sc = arg; + if (sc->flags & LM78_DEAD) { + /* Remove sensors */ + int i; + + printf("%s: disabling sensors\n", sc->sc_dev.dv_xname); + sensordev_deinstall(&sc->sensordev); + for (i = 0; i < sc->numsensors; i++) + sensor_detach(&sc->sensordev, &sc->sensors[i]); + if (sc->sensortask != NULL) + sensor_task_unregister(sc->sensortask); + sc->sensortask = NULL; + return; + } + sc->refresh_sensor_data(sc); } diff --git a/sys/dev/ic/lm78var.h b/sys/dev/ic/lm78var.h index d664e3b0754..8566ffe4a1e 100644 --- a/sys/dev/ic/lm78var.h +++ b/sys/dev/ic/lm78var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: lm78var.h,v 1.14 2007/06/25 22:50:18 cnst Exp $ */ +/* $OpenBSD: lm78var.h,v 1.15 2011/07/26 18:43:35 deraadt Exp $ */ /* * Copyright (c) 2005, 2006 Mark Kettenis @@ -152,7 +152,9 @@ struct lm_softc { u_int8_t sbusaddr; u_int8_t chipid; u_int8_t vrm9; + +#define LM78_DEAD 1 + int flags; }; void lm_attach(struct lm_softc *); -int lm_detach(struct lm_softc *); |