Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-6]: src/sys/dev Pull up following revision(s) (requested by mrg i...



details:   https://anonhg.NetBSD.org/src/rev/b0e72c4cea6a
branches:  netbsd-6
changeset: 773988:b0e72c4cea6a
user:      riz <riz%NetBSD.org@localhost>
date:      Mon Apr 09 17:46:58 2012 +0000

description:
Pull up following revision(s) (requested by mrg in ticket #164):
        sys/dev/audio.c: revision 1.259
deal with PR#46232:  ensure locking around audio_clear() is handled
consistently and avoid locking against self.

diffstat:

 sys/dev/audio.c |  30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)

diffs (121 lines):

diff -r 453292d95bbd -r b0e72c4cea6a sys/dev/audio.c
--- a/sys/dev/audio.c   Fri Apr 06 17:48:09 2012 +0000
+++ b/sys/dev/audio.c   Mon Apr 09 17:46:58 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.257.2.1 2012/02/23 18:23:03 riz Exp $      */
+/*     $NetBSD: audio.c,v 1.257.2.2 2012/04/09 17:46:58 riz Exp $      */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.257.2.1 2012/02/23 18:23:03 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.257.2.2 2012/04/09 17:46:58 riz Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -241,6 +241,7 @@
 void   audio_calcwater(struct audio_softc *);
 int    audio_drain(struct audio_softc *);
 void   audio_clear(struct audio_softc *);
+void   audio_clear_intr_unlocked(struct audio_softc *sc);
 static inline void audio_pint_silence
        (struct audio_softc *, struct audio_ringbuffer *, uint8_t *, int);
 
@@ -1992,7 +1993,6 @@
 
        KASSERT(mutex_owned(sc->sc_lock));
 
-       mutex_enter(sc->sc_intr_lock);
        if (sc->sc_rbus) {
                cv_broadcast(&sc->sc_rchan);
                sc->hw_if->halt_input(sc->hw_hdl);
@@ -2005,6 +2005,14 @@
                sc->sc_pbus = false;
                sc->sc_pr.pause = false;
        }
+}
+
+void
+audio_clear_intr_unlocked(struct audio_softc *sc)
+{
+
+       mutex_enter(sc->sc_intr_lock);
+       audio_clear(sc);
        mutex_exit(sc->sc_intr_lock);
 }
 
@@ -3643,7 +3651,7 @@
        setmode = 0;
        if (nr > 0) {
                if (!cleared) {
-                       audio_clear(sc);
+                       audio_clear_intr_unlocked(sc);
                        cleared = true;
                }
                modechange = true;
@@ -3651,7 +3659,7 @@
        }
        if (np > 0) {
                if (!cleared) {
-                       audio_clear(sc);
+                       audio_clear_intr_unlocked(sc);
                        cleared = true;
                }
                modechange = true;
@@ -3660,7 +3668,7 @@
 
        if (SPECIFIED(ai->mode)) {
                if (!cleared) {
-                       audio_clear(sc);
+                       audio_clear_intr_unlocked(sc);
                        cleared = true;
                }
                modechange = true;
@@ -3754,7 +3762,7 @@
 
        if (SPECIFIED(p->port)) {
                if (!cleared) {
-                       audio_clear(sc);
+                       audio_clear_intr_unlocked(sc);
                        cleared = true;
                }
                error = au_set_port(sc, &sc->sc_outports, p->port);
@@ -3763,7 +3771,7 @@
        }
        if (SPECIFIED(r->port)) {
                if (!cleared) {
-                       audio_clear(sc);
+                       audio_clear_intr_unlocked(sc);
                        cleared = true;
                }
                error = au_set_port(sc, &sc->sc_inports, r->port);
@@ -3825,7 +3833,7 @@
                /* Block size specified explicitly. */
                if (ai->blocksize == 0) {
                        if (!cleared) {
-                               audio_clear(sc);
+                               audio_clear_intr_unlocked(sc);
                                cleared = true;
                        }
                        sc->sc_blkset = false;
@@ -3836,7 +3844,7 @@
                        /* check whether new blocksize changes actually */
                        if (hw->round_blocksize == NULL) {
                                if (!cleared) {
-                                       audio_clear(sc);
+                                       audio_clear_intr_unlocked(sc);
                                        cleared = true;
                                }
                                sc->sc_pr.blksize = ai->blocksize;
@@ -3849,7 +3857,7 @@
                                if (pblksize != sc->sc_pr.blksize ||
                                    rblksize != sc->sc_rr.blksize) {
                                        if (!cleared) {
-                                               audio_clear(sc);
+                                               audio_clear_intr_unlocked(sc);
                                                cleared = true;
                                        }
                                        sc->sc_pr.blksize = ai->blocksize;



Home | Main Index | Thread Index | Old Index