Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/9e07fbc50d5d
branches:  netbsd-8
changeset: 433987:9e07fbc50d5d
user:      snj <snj%NetBSD.org@localhost>
date:      Fri Jun 09 17:00:46 2017 +0000

description:
Pull up following revision(s) (requested by nat in ticket #18):
        sys/dev/audio.c: revision 1.358
Retrn error to userland from startp/startr depending on the error from
trigger/start output/input.
Found by jmcneill@.

diffstat:

 sys/dev/audio.c |  31 +++++++++++++++++++++----------
 1 files changed, 21 insertions(+), 10 deletions(-)

diffs (115 lines):

diff -r 9d37d6fecfc3 -r 9e07fbc50d5d sys/dev/audio.c
--- a/sys/dev/audio.c   Fri Jun 09 16:59:20 2017 +0000
+++ b/sys/dev/audio.c   Fri Jun 09 17:00:46 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.357 2017/06/01 09:44:30 pgoyette Exp $     */
+/*     $NetBSD: audio.c,v 1.357.2.1 2017/06/09 17:00:46 snj Exp $      */
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357 2017/06/01 09:44:30 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.357.2.1 2017/06/09 17:00:46 snj Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -267,8 +267,8 @@
                      size_t, struct virtual_channel *);
 void   mix_func(struct audio_softc *, struct audio_ringbuffer *,
                 struct virtual_channel *);
-void   mix_write(void *);
-void   mix_read(void *);
+int    mix_write(void *);
+int    mix_read(void *);
 int    audio_check_params(struct audio_params *);
 
 void   audio_calc_blksize(struct audio_softc *, int, struct virtual_channel *);
@@ -3485,6 +3485,8 @@
 audiostartr(struct audio_softc *sc, struct virtual_channel *vc)
 {
 
+       int error;
+
        KASSERT(mutex_owned(sc->sc_lock));
 
        DPRINTF(("audiostartr: start=%p used=%d(hi=%d) mmapped=%d\n",
@@ -3494,15 +3496,16 @@
        if (!audio_can_capture(sc))
                return EINVAL;
 
+       error = 0;
        if (sc->sc_rec_started == false) {
                mutex_enter(sc->sc_intr_lock);
-               mix_read(sc);
+               error = mix_read(sc);
                cv_broadcast(&sc->sc_rcondvar);
                mutex_exit(sc->sc_intr_lock);
        }
        vc->sc_rbus = true;
 
-       return 0;
+       return error;
 }
 
 int
@@ -3534,13 +3537,16 @@
                audio_mix(sc);
                audio_mix(sc);
                mutex_enter(sc->sc_intr_lock);
-               mix_write(sc);
+               error = mix_write(sc);
+               if (error)
+                       goto done;
                vc = chan->vc;
                vc->sc_mpr.s.outp =
                    audio_stream_add_outp(&vc->sc_mpr.s,
                      vc->sc_mpr.s.outp, vc->sc_mpr.blksize);
-               mix_write(sc);
+               error = mix_write(sc);
                cv_broadcast(&sc->sc_condvar);
+done:
                mutex_exit(sc->sc_intr_lock);
        }
 
@@ -5450,7 +5456,7 @@
        return audio_get_props(sc) & AUDIO_PROP_CAPTURE ? true : false;
 }
 
-void
+int
 mix_read(void *arg)
 {
        struct audio_softc *sc = arg;
@@ -5486,6 +5492,7 @@
                DPRINTF(("audio_upmix restart failed: %d\n", error));
                audio_clear(sc, SIMPLEQ_FIRST(&sc->sc_audiochan)->vc);
                sc->sc_rec_started = false;
+               return error;
        }
 
        inp = vc->sc_mrr.s.inp;
@@ -5513,9 +5520,11 @@
            blksize);
        vc->sc_rustream->outp = audio_stream_add_outp(vc->sc_rustream,
            vc->sc_rustream->outp, blksize);
+       
+       return error;
 }
 
-void
+int
 mix_write(void *arg)
 {
        struct audio_softc *sc = arg;
@@ -5595,6 +5604,8 @@
                audio_clear(sc, SIMPLEQ_FIRST(&sc->sc_audiochan)->vc);
                sc->sc_trigger_started = false;
        }
+
+       return error;
 }
 
 #define DEF_MIX_FUNC(name, type, MINVAL, MAXVAL)               \



Home | Main Index | Thread Index | Old Index