Module Name:    src
Committed By:   isaki
Date:           Sun Aug 13 05:04:08 UTC 2017

Modified Files:
        src/sys/dev: audio.c audiovar.h

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.392 -r1.393 src/sys/dev/audio.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/audiovar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.392 src/sys/dev/audio.c:1.393
--- src/sys/dev/audio.c:1.392	Tue Aug  8 22:21:35 2017
+++ src/sys/dev/audio.c	Sun Aug 13 05:04:08 2017
@@ -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 <nathanialsl...@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
 	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
 
 	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 
 
 	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_qua
 	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
 
 	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, i
 	
 	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;

Index: src/sys/dev/audiovar.h
diff -u src/sys/dev/audiovar.h:1.61 src/sys/dev/audiovar.h:1.62
--- src/sys/dev/audiovar.h:1.61	Sun Aug 13 04:09:27 2017
+++ src/sys/dev/audiovar.h	Sun Aug 13 05:04:08 2017
@@ -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 */

Reply via email to