Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/isa avoid mutex locking botch and introduce an unloc...
details: https://anonhg.NetBSD.org/src/rev/4e2a837ada3d
branches: trunk
changeset: 765318:4e2a837ada3d
user: mrg <mrg%NetBSD.org@localhost>
date: Tue May 24 09:28:03 2011 +0000
description:
avoid mutex locking botch and introduce an unlocked version of
pcppi_bell_stop(). fixes a problem reported in private email.
diffstat:
sys/dev/isa/pcppi.c | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diffs (73 lines):
diff -r b973fafb7ef6 -r 4e2a837ada3d sys/dev/isa/pcppi.c
--- a/sys/dev/isa/pcppi.c Tue May 24 08:54:40 2011 +0000
+++ b/sys/dev/isa/pcppi.c Tue May 24 09:28:03 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppi.c,v 1.36 2011/05/03 04:27:13 mrg Exp $ */
+/* $NetBSD: pcppi.c,v 1.37 2011/05/24 09:28:03 mrg Exp $ */
/*
* Copyright (c) 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.36 2011/05/03 04:27:13 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.37 2011/05/24 09:28:03 mrg Exp $");
#include "attimer.h"
@@ -66,6 +66,7 @@
DVF_DETACH_SHUTDOWN);
static int pcppisearch(device_t, cfdata_t, const int *, void *);
+static void pcppi_bell_stop_unlocked(void*);
static void pcppi_bell_stop(void*);
#if NATTIMER > 0
@@ -285,7 +286,7 @@
cv_broadcast(&sc->sc_stop_cv);
}
if (pitch == 0 || period == 0) {
- pcppi_bell_stop(sc);
+ pcppi_bell_stop_unlocked(sc);
sc->sc_bellpitch = 0;
mutex_exit(&sc->sc_lock);
return;
@@ -305,7 +306,7 @@
sc->sc_bellactive = 1;
if (slp & PCPPI_BELL_POLL) {
delay((period * 1000000) / hz);
- pcppi_bell_stop(sc);
+ pcppi_bell_stop_unlocked(sc);
} else {
sc->sc_timeout = 1;
callout_reset(&sc->sc_bell_ch, period, pcppi_bell_stop, sc);
@@ -319,11 +320,10 @@
}
static void
-pcppi_bell_stop(void *arg)
+pcppi_bell_stop_unlocked(void *arg)
{
struct pcppi_softc *sc = arg;
- mutex_enter(&sc->sc_lock);
sc->sc_timeout = 0;
/* disable bell */
@@ -333,6 +333,15 @@
sc->sc_bellactive = 0;
if (sc->sc_slp)
cv_broadcast(&sc->sc_stop_cv);
+}
+
+static void
+pcppi_bell_stop(void *arg)
+{
+ struct pcppi_softc *sc = arg;
+
+ mutex_enter(&sc->sc_lock);
+ pcppi_bell_stop_unlocked(arg);
mutex_exit(&sc->sc_lock);
}
Home |
Main Index |
Thread Index |
Old Index