Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Allow open of audioctl devices whilst audio is open ...



details:   https://anonhg.NetBSD.org/src/rev/475079e52943
branches:  trunk
changeset: 828956:475079e52943
user:      nat <nat%NetBSD.org@localhost>
date:      Fri Jan 12 04:10:10 2018 +0000

description:
Allow open of audioctl devices whilst audio is open with the mixer
disabled.

XXX pullup -8

diffstat:

 sys/dev/audio.c |  15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diffs (60 lines):

diff -r b98c8d716669 -r 475079e52943 sys/dev/audio.c
--- a/sys/dev/audio.c   Thu Jan 11 13:44:26 2018 +0000
+++ b/sys/dev/audio.c   Fri Jan 12 04:10:10 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.449 2018/01/09 04:14:21 nat Exp $  */
+/*     $NetBSD: audio.c,v 1.450 2018/01/12 04:10:10 nat 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.449 2018/01/09 04:14:21 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.450 2018/01/12 04:10:10 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -2175,6 +2175,9 @@
                vc = sc->sc_hwvc;
        chan->vc = vc;
 
+       if (!sc->sc_usemixer && AUDIODEV(dev) == AUDIOCTL_DEVICE)
+               goto audioctl_dev;
+
        if (sc->sc_usemixer) {
                vc->sc_open = 0;
                vc->sc_mode = 0;
@@ -2292,9 +2295,12 @@
        /* audio_close() decreases sc_mpr[n].usedlow, recalculate here */
        audio_calcwater(sc, vc);
 
+audioctl_dev:
        error = fd_allocfile(&fp, &fd);
        if (error)
                goto bad;
+       if (!sc->sc_usemixer && AUDIODEV(dev) == AUDIOCTL_DEVICE)
+               goto setup_chan;
 
        DPRINTF(("audio_open: done sc_mode = 0x%x\n", vc->sc_mode));
 
@@ -2304,6 +2310,8 @@
                sc->sc_recopens++;
        if (flags & FWRITE)
                sc->sc_opens++;
+
+setup_chan:
        chan->dev = dev;
        chan->chan = n;
        chan->deschan = n;
@@ -2480,6 +2488,9 @@
 
        KASSERT(mutex_owned(sc->sc_lock));
        
+       if (!sc->sc_usemixer && AUDIODEV(chan->dev) == AUDIOCTL_DEVICE)
+               return 0;
+
        if (sc->sc_opens == 0 && sc->sc_recopens == 0)
                return ENXIO;
 



Home | Main Index | Thread Index | Old Index