Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Fix channel assignment for multiple channels.
details: https://anonhg.NetBSD.org/src/rev/42acf4838ded
branches: trunk
changeset: 352378:42acf4838ded
user: nat <nat%NetBSD.org@localhost>
date: Wed Mar 29 06:24:22 2017 +0000
description:
Fix channel assignment for multiple channels.
This fixes a problem if two or more channels are opened and the first
(any but last channel) is closed and new channels are opened.
diffstat:
sys/dev/audio.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diffs (36 lines):
diff -r 26cef1e57f8e -r 42acf4838ded sys/dev/audio.c
--- a/sys/dev/audio.c Tue Mar 28 20:32:43 2017 +0000
+++ b/sys/dev/audio.c Wed Mar 29 06:24:22 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.318 2017/03/27 23:25:24 nat Exp $ */
+/* $NetBSD: audio.c,v 1.319 2017/03/29 06:24:22 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.318 2017/03/27 23:25:24 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.319 2017/03/29 06:24:22 nat Exp $");
#include "audio.h"
#if NAUDIO > 0
@@ -2084,9 +2084,14 @@
hw = sc->hw_if;
if (hw == NULL)
return ENXIO;
- n = 0;
- SIMPLEQ_FOREACH(chan, &sc->sc_audiochan, entries)
- n++;
+ n = 1;
+ SIMPLEQ_FOREACH(chan, &sc->sc_audiochan, entries) {
+ if (chan == SIMPLEQ_FIRST(&sc->sc_audiochan))
+ continue;
+ n = chan->chan + 1;
+ }
+ if (n < 0)
+ return ENOMEM;
chan = kmem_zalloc(sizeof(struct audio_chan), KM_SLEEP);
vc = kmem_zalloc(sizeof(struct virtual_channel), KM_SLEEP);
Home |
Main Index |
Thread Index |
Old Index