Module Name:    src
Committed By:   bouyer
Date:           Sat Jun 18 22:47:20 UTC 2011

Modified Files:
        src/sys/dev/isa [netbsd-5]: pcppi.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1625):
        sys/dev/isa/pcppi.c: revision 1.37
avoid mutex locking botch and introduce an unlocked version of
pcppi_bell_stop().  fixes a problem reported in private email.


To generate a diff of this commit:
cvs rdiff -u -r1.32.14.2 -r1.32.14.3 src/sys/dev/isa/pcppi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/isa/pcppi.c
diff -u src/sys/dev/isa/pcppi.c:1.32.14.2 src/sys/dev/isa/pcppi.c:1.32.14.3
--- src/sys/dev/isa/pcppi.c:1.32.14.2	Sat Jun 18 16:24:10 2011
+++ src/sys/dev/isa/pcppi.c	Sat Jun 18 22:47:20 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: pcppi.c,v 1.32.14.2 2011/06/18 16:24:10 bouyer Exp $ */
+/* $NetBSD: pcppi.c,v 1.32.14.3 2011/06/18 22:47:20 bouyer Exp $ */
 
 /*
  * Copyright (c) 1996 Carnegie-Mellon University.
@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.32.14.2 2011/06/18 16:24:10 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcppi.c,v 1.32.14.3 2011/06/18 22:47:20 bouyer Exp $");
 
 #include "attimer.h"
 
@@ -65,6 +65,7 @@
     pcppi_match, pcppi_isa_attach, pcppi_detach, NULL, NULL, pcppi_childdet);
 
 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
@@ -270,7 +271,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;
@@ -290,7 +291,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);
@@ -304,11 +305,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 */
@@ -318,6 +318,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);
 }
 

Reply via email to