Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Remove mixer chan from sc_audiochan.



details:   https://anonhg.NetBSD.org/src/rev/bfa611b684d2
branches:  trunk
changeset: 826062:bfa611b684d2
user:      isaki <isaki%NetBSD.org@localhost>
date:      Sun Aug 13 05:04:08 2017 +0000

description:
Remove mixer chan from sc_audiochan.
Now sc_audiochan contains opened audio chan (and first special
element) only.

First I splitted sc_audiochan into sc_audiochan which has
audio chan (and first special element) and sc_mixerchan
which has mixer chan only.  However nobody else refers this
sc_mixerchan except additions to list and deletions from
list.  So mixer chan's list is not necessary.

diffstat:

 sys/dev/audio.c    |  29 +++++------------------------
 sys/dev/audiovar.h |   5 ++---
 2 files changed, 7 insertions(+), 27 deletions(-)

diffs (138 lines):

diff -r 790cafebf8c4 -r bfa611b684d2 sys/dev/audio.c
--- a/sys/dev/audio.c   Sun Aug 13 04:09:27 2017 +0000
+++ b/sys/dev/audio.c   Sun Aug 13 05:04:08 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audio.c,v 1.392 2017/08/08 22:21:35 nat Exp $  */
+/*     $NetBSD: audio.c,v 1.393 2017/08/13 05:04:08 isaki 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.392 2017/08/08 22:21:35 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.393 2017/08/13 05:04:08 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -927,16 +927,12 @@
 
        /* free resources */
        SIMPLEQ_FOREACH(chan, &sc->sc_audiochan, entries) {
-               if (chan->chan == MIXER_INUSE)
-                       continue;
                audio_free_ring(sc, &chan->vc->sc_mpr);
                audio_free_ring(sc, &chan->vc->sc_mrr);
        }
        audio_free_ring(sc, &sc->sc_pr);
        audio_free_ring(sc, &sc->sc_rr);
        SIMPLEQ_FOREACH(chan, &sc->sc_audiochan, entries) {
-               if (chan->chan == MIXER_INUSE)
-                       continue;
                audio_destroy_pfilters(chan->vc);
                audio_destroy_rfilters(chan->vc);
        }
@@ -2140,8 +2136,6 @@
        SIMPLEQ_FOREACH(chan, &sc->sc_audiochan, entries) {
                if (chan == SIMPLEQ_FIRST(&sc->sc_audiochan))
                        continue;
-               if (chan->chan == MIXER_INUSE)
-                       continue;
                n = chan->chan + 1;
        }
        if (n < 0)
@@ -3707,9 +3701,6 @@
                if (chan == SIMPLEQ_FIRST(&sc->sc_audiochan))
                        continue;
 
-               if (chan->chan == MIXER_INUSE)
-                       continue;
-
                vc = chan->vc;
 
                if (!vc->sc_open)
@@ -3921,9 +3912,6 @@
                if (chan == SIMPLEQ_FIRST(&sc->sc_audiochan))
                        continue;
 
-               if (chan->chan == MIXER_INUSE)
-                       continue;
-
                vc = chan->vc;
 
                if (!(vc->sc_open & AUOPEN_READ))
@@ -4964,9 +4952,6 @@
 
        chan = kmem_zalloc(sizeof(struct audio_chan), KM_SLEEP);
        chan->dev = dev;
-       chan->chan = MIXER_INUSE;
-
-       SIMPLEQ_INSERT_TAIL(&sc->sc_audiochan, chan, entries);
 
        error = fd_clone(fp, fd, flags, &audio_fileops, chan);
        KASSERT(error == EMOVEFD);
@@ -5028,7 +5013,6 @@
 
        DPRINTF(("mixer_close: sc %p\n", sc));
        mixer_remove(sc);
-       SIMPLEQ_REMOVE(&sc->sc_audiochan, chan, audio_chan, entries);
 
        return 0;
 }
@@ -5268,8 +5252,7 @@
        mutex_enter(sc->sc_lock);
        audio_mixer_capture(sc);
        SIMPLEQ_FOREACH(chan, &sc->sc_audiochan, entries) {
-               if (chan == SIMPLEQ_FIRST(&sc->sc_audiochan) ||
-                       chan->chan == MIXER_INUSE)
+               if (chan == SIMPLEQ_FIRST(&sc->sc_audiochan))
                        continue;
 
                vc = chan->vc;
@@ -5308,8 +5291,7 @@
 
        audio_mixer_restore(sc);
        SIMPLEQ_FOREACH(chan, &sc->sc_audiochan, entries) {
-               if (chan == SIMPLEQ_FIRST(&sc->sc_audiochan) ||
-                               chan->chan == MIXER_INUSE)
+               if (chan == SIMPLEQ_FIRST(&sc->sc_audiochan))
                        continue;
                vc = chan->vc;
 
@@ -5707,8 +5689,7 @@
        
        j = 0;
        SIMPLEQ_FOREACH(chan, &sc->sc_audiochan, entries) {
-               if (chan == SIMPLEQ_FIRST(&sc->sc_audiochan) ||
-                   chan->chan == MIXER_INUSE)
+               if (chan == SIMPLEQ_FIRST(&sc->sc_audiochan))
                        continue;
                if (j == n)
                        break;
diff -r 790cafebf8c4 -r bfa611b684d2 sys/dev/audiovar.h
--- a/sys/dev/audiovar.h        Sun Aug 13 04:09:27 2017 +0000
+++ b/sys/dev/audiovar.h        Sun Aug 13 05:04:08 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: audiovar.h,v 1.61 2017/08/13 04:09:27 isaki Exp $      */
+/*     $NetBSD: audiovar.h,v 1.62 2017/08/13 05:04:08 isaki Exp $      */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -116,7 +116,6 @@
        struct virtual_channel  *vc;
        int     chan;                   /* virtual channel */
        int     deschan;                /* desired channel for ioctls*/
-#define MIXER_INUSE    -2
        SIMPLEQ_ENTRY(audio_chan) entries;
 };
 
@@ -183,7 +182,7 @@
        void            *hw_hdl;        /* Hardware driver handle */
        const struct audio_hw_if *hw_if; /* Hardware interface */
        device_t        sc_dev;         /* Hardware device struct */
-       struct chan_queue sc_audiochan; /* queue of open chans */
+       struct chan_queue sc_audiochan; /* queue of open audio chans */
 
        struct audio_encoding_set *sc_encodings;
        struct  selinfo sc_wsel; /* write selector */



Home | Main Index | Thread Index | Old Index