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.
This commit is contained in:
isaki 2017-08-13 05:04:08 +00:00
parent e0da01f938
commit 7abef65771
2 changed files with 7 additions and 27 deletions

View File

@ -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>
@ -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 @@ audiodetach(device_t self, int flags)
/* 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 @@ audio_open(dev_t dev, struct audio_softc *sc, int flags, int ifmt,
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 @@ audio_mix(void *v)
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 @@ audio_upmix(void *v)
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 @@ mixer_open(dev_t dev, struct audio_softc *sc, int flags,
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 @@ mixer_close(struct audio_softc *sc, int flags, struct audio_chan *chan)
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 @@ audio_suspend(device_t dv, const pmf_qual_t *qual)
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_resume(device_t dv, const pmf_qual_t *qual)
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 @@ find_vchan_vol(struct audio_softc *sc, int d)
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;

View File

@ -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 audio_chan {
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 @@ struct audio_softc {
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 */