Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64/dev Add a detach function and use this when...
details: https://anonhg.NetBSD.org/src/rev/e759037e78c0
branches: trunk
changeset: 784606:e759037e78c0
user: jdc <jdc%NetBSD.org@localhost>
date: Sun Feb 03 10:58:28 2013 +0000
description:
Add a detach function and use this when shutting down:
halt the fan speed callout
set the speed of both fans to maximum
Also avoids occasional panics in shutdown because the callout is not stopped.
diffstat:
sys/arch/sparc64/dev/tda.c | 26 ++++++++++++++++++++++----
1 files changed, 22 insertions(+), 4 deletions(-)
diffs (61 lines):
diff -r b93af8a80a4b -r e759037e78c0 sys/arch/sparc64/dev/tda.c
--- a/sys/arch/sparc64/dev/tda.c Sun Feb 03 09:16:24 2013 +0000
+++ b/sys/arch/sparc64/dev/tda.c Sun Feb 03 10:58:28 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tda.c,v 1.7 2013/02/02 21:54:51 jdc Exp $ */
+/* $NetBSD: tda.c,v 1.8 2013/02/03 10:58:28 jdc Exp $ */
/* $OpenBSD: tda.c,v 1.4 2008/02/27 17:25:00 robert Exp $ */
/*
@@ -19,7 +19,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tda.c,v 1.7 2013/02/02 21:54:51 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tda.c,v 1.8 2013/02/03 10:58:28 jdc Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -73,6 +73,7 @@
int tda_match(device_t, cfdata_t, void *);
void tda_attach(device_t, device_t, void *);
+static int tda_detach(device_t, int);
void tda_refresh(struct sysmon_envsys *, envsys_data_t *);
void tda_setspeed(struct tda_softc *);
@@ -80,8 +81,9 @@
static void tda_timeout(void *);
-CFATTACH_DECL_NEW(tda, sizeof(struct tda_softc),
- tda_match, tda_attach, NULL, NULL);
+CFATTACH_DECL3_NEW(tda, sizeof(struct tda_softc),
+ tda_match, tda_attach, tda_detach, NULL, NULL, NULL,
+ DVF_DETACH_SHUTDOWN);
int
tda_match(device_t parent, cfdata_t match, void *aux)
@@ -164,6 +166,22 @@
}
}
+int
+tda_detach(device_t self, int flags)
+{
+ struct tda_softc *sc = device_private(self);
+
+ if (sc->sc_sme != NULL)
+ sysmon_envsys_destroy(sc->sc_sme);
+
+ callout_halt(&sc->sc_timer, NULL);
+ callout_destroy(&sc->sc_timer);
+
+ sc->sc_cfan_speed = sc->sc_sfan_speed = TDA_FANSPEED_MAX;
+ tda_setspeed(sc);
+ return 0;
+}
+
static void
tda_timeout(void *v)
{
Home |
Main Index |
Thread Index |
Old Index