Source-Changes-HG archive

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

[src/netbsd-3-0]: src/sys/dev Pull up following revision(s) (requested by jmc...



details:   https://anonhg.NetBSD.org/src/rev/c6340e555ec7
branches:  netbsd-3-0
changeset: 579204:c6340e555ec7
user:      tron <tron%NetBSD.org@localhost>
date:      Wed Apr 19 21:01:00 2006 +0000

description:
Pull up following revision(s) (requested by jmcneill in ticket #1281):
        sys/dev/audio_if.h: revision 1.61
        sys/dev/audiovar.h: revision 1.36
        sys/dev/audio.c: revision 1.204 via patch
Don't use simple_locks; we can't hold them while calling malloc and
friends.

diffstat:

 sys/dev/audio.c    |  28 +++++++++++++++-------------
 sys/dev/audio_if.h |   3 +--
 sys/dev/audiovar.h |   6 ++++--
 3 files changed, 20 insertions(+), 17 deletions(-)

diffs (141 lines):

diff -r c5e7f2c182bc -r c6340e555ec7 sys/dev/audio.c
--- a/sys/dev/audio.c   Wed Apr 19 15:55:04 2006 +0000
+++ b/sys/dev/audio.c   Wed Apr 19 21:01:00 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.192.4.2.2.1 2006/04/18 21:15:07 tron Exp $ */
+/*     $NetBSD: audio.c,v 1.192.4.2.2.2 2006/04/19 21:01:00 tron Exp $ */
 
 /*
  * Copyright (c) 1991-1993 Regents of the University of California.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.192.4.2.2.1 2006/04/18 21:15:07 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.192.4.2.2.2 2006/04/19 21:01:00 tron Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -81,7 +81,6 @@
 #include <sys/conf.h>
 #include <sys/audioio.h>
 #include <sys/device.h>
-#include <sys/lock.h>
 
 #include <dev/audio_if.h>
 #include <dev/audiovar.h>
@@ -308,7 +307,7 @@
        sc->hw_if = hwp;
        sc->hw_hdl = hdlp;
        sc->sc_dev = parent;
-       simple_lock_init(&sc->sc_pfiltlock);
+       sc->sc_writing = sc->sc_waitcomp = 0;
 
        error = audio_alloc_ring(sc, &sc->sc_pr, AUMODE_PLAY, AU_RING_SIZE);
        if (error) {
@@ -661,7 +660,10 @@
        audio_params_t *to_param;
        int i, n;
 
-       simple_lock(&sc->sc_pfiltlock);
+       while (sc->sc_writing) {
+               sc->sc_waitcomp = 1;
+               (void)tsleep(sc, 0, "audioch", 10*hz);
+       }
 
        memset(pf, 0, sizeof(pf));
        memset(ps, 0, sizeof(ps));
@@ -686,7 +688,7 @@
                                pf[i]->dtor(pf[i]);
                        audio_stream_dtor(&ps[i]);
                }
-               simple_unlock(&sc->sc_pfiltlock);
+               sc->sc_waitcomp = 0;
                return EINVAL;
        }
 
@@ -717,7 +719,7 @@
        audio_print_params("[HW]", &sc->sc_pr.s.param);
 #endif /* AUDIO_DEBUG */
 
-       simple_unlock(&sc->sc_pfiltlock);
+       sc->sc_waitcomp = 0;
        return 0;
 }
 
@@ -796,16 +798,12 @@
 {
        int i;
 
-       simple_lock(&sc->sc_pfiltlock);
-
        for (i = 0; i < sc->sc_npfilters; i++) {
                sc->sc_pfilters[i]->dtor(sc->sc_pfilters[i]);
                sc->sc_pfilters[i] = NULL;
                audio_stream_dtor(&sc->sc_pstreams[i]);
        }
        sc->sc_npfilters = 0;
-
-       simple_unlock(&sc->sc_pfiltlock);
 }
 
 static void
@@ -1909,7 +1907,8 @@
                 * splaudio() enclosure
                 */
 
-               simple_lock(&sc->sc_pfiltlock);
+               sc->sc_writing = 1;
+
                if (sc->sc_npfilters > 0) {
                        filter = sc->sc_pfilters[0];
                        filter->set_fetcher(filter, &ufetcher.base);
@@ -1921,7 +1920,10 @@
                        fetcher = &ufetcher.base;
                }
                error = fetcher->fetch_to(fetcher, &stream, cc);
-               simple_unlock(&sc->sc_pfiltlock);
+
+               sc->sc_writing = 0;
+               if (sc->sc_waitcomp)
+                       wakeup(sc);
 
                s = splaudio();
                if (sc->sc_npfilters > 0) {
diff -r c5e7f2c182bc -r c6340e555ec7 sys/dev/audio_if.h
--- a/sys/dev/audio_if.h        Wed Apr 19 15:55:04 2006 +0000
+++ b/sys/dev/audio_if.h        Wed Apr 19 21:01:00 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio_if.h,v 1.55.18.1 2006/04/18 21:15:07 tron Exp $  */
+/*     $NetBSD: audio_if.h,v 1.55.18.2 2006/04/19 21:01:00 tron Exp $  */
 
 /*
  * Copyright (c) 1994 Havard Eidnes.
@@ -37,7 +37,6 @@
 #ifndef _SYS_DEV_AUDIO_IF_H_
 #define _SYS_DEV_AUDIO_IF_H_
 #include <sys/types.h>
-#include <sys/lock.h>
 #include <sys/audioio.h>
 
 /* check we have an audio(4) configured into kernel */
diff -r c5e7f2c182bc -r c6340e555ec7 sys/dev/audiovar.h
--- a/sys/dev/audiovar.h        Wed Apr 19 15:55:04 2006 +0000
+++ b/sys/dev/audiovar.h        Wed Apr 19 21:01:00 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audiovar.h,v 1.32.18.1 2006/04/18 21:15:07 tron Exp $  */
+/*     $NetBSD: audiovar.h,v 1.32.18.2 2006/04/19 21:01:00 tron Exp $  */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -174,7 +174,9 @@
        audio_stream_t          sc_pstreams[AUDIO_MAX_FILTERS];
        stream_filter_t         *sc_pfilters[AUDIO_MAX_FILTERS];
        struct audio_ringbuffer sc_pr;          /* Play ring */
-       struct simplelock       sc_pfiltlock;
+       int                     sc_writing;
+       int                     sc_waitcomp;
+       int                     sc_changing;
 
        /**
         *  hardware



Home | Main Index | Thread Index | Old Index