diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -260,7 +260,7 @@ int chn_poll(struct pcm_channel *c, int ev, struct thread *td); struct pcm_channel *chn_init(struct snddev_info *d, struct pcm_channel *parent, - kobj_class_t cls, int dir, int num, void *devinfo); + kobj_class_t cls, int dir, void *devinfo); void chn_kill(struct pcm_channel *c); void chn_shutdown(struct pcm_channel *c); int chn_release(struct pcm_channel *c); diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1159,7 +1159,7 @@ struct pcm_channel * chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, - int dir, int num, void *devinfo) + int dir, void *devinfo) { struct pcm_channel *c; struct feeder_class *fc; @@ -1169,7 +1169,6 @@ PCM_BUSYASSERT(d); PCM_LOCKASSERT(d); - KASSERT(num >= -1, ("invalid num=%d", num)); switch (dir) { case PCMDIR_PLAY: @@ -1207,7 +1206,7 @@ goto out1; } - unit = (num == -1) ? 0 : num; + unit = 0; if (*pnum >= max || unit >= max) { device_printf(d->dev, "%s(): unit=%d or pnum=%d >= than " @@ -1220,12 +1219,6 @@ CHN_FOREACH(c, d, channels.pcm) { if (c->type != type) continue; - if (unit == c->unit && num != -1) { - device_printf(d->dev, - "%s(): channel num=%d already allocated\n", - __func__, unit); - goto out1; - } unit++; if (unit >= max) { device_printf(d->dev, diff --git a/sys/dev/sound/pcm/sound.c b/sys/dev/sound/pcm/sound.c --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -165,7 +165,7 @@ /* no channel available */ if (!(vchancount > 0 && vchancount < snd_maxautovchans)) return (err); - err = vchan_setnew(d, direction, vchancount + 1, -1); + err = vchan_setnew(d, direction, vchancount + 1); if (err == 0) { retry = true; goto retry_chnalloc; @@ -274,7 +274,7 @@ PCM_BUSYASSERT(d); PCM_LOCK(d); - ch = chn_init(d, NULL, cls, dir, -1, devinfo); + ch = chn_init(d, NULL, cls, dir, devinfo); if (!ch) { device_printf(d->dev, "chn_init(%s, %d, %p) failed\n", cls->name, dir, devinfo); diff --git a/sys/dev/sound/pcm/vchan.h b/sys/dev/sound/pcm/vchan.h --- a/sys/dev/sound/pcm/vchan.h +++ b/sys/dev/sound/pcm/vchan.h @@ -32,7 +32,7 @@ extern int snd_maxautovchans; -int vchan_create(struct pcm_channel *, int); +int vchan_create(struct pcm_channel *); int vchan_destroy(struct pcm_channel *); #ifdef SND_DEBUG @@ -47,7 +47,7 @@ sndbuf_getfmt((c)->bufhard) != (c)->parentchannel->format || \ sndbuf_getspd((c)->bufhard) != (c)->parentchannel->speed)) -int vchan_setnew(struct snddev_info *, int, int, int); +int vchan_setnew(struct snddev_info *, int, int); void vchan_setmaxauto(struct snddev_info *, int); void vchan_initsys(device_t); diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -339,7 +339,7 @@ cnt = 0; if (cnt > SND_MAXVCHANS) cnt = SND_MAXVCHANS; - err = vchan_setnew(d, direction, cnt, -1); + err = vchan_setnew(d, direction, cnt); } PCM_RELEASE_QUICK(d); @@ -664,7 +664,7 @@ "play.vchanrate" : "rec.vchanrate" int -vchan_create(struct pcm_channel *parent, int num) +vchan_create(struct pcm_channel *parent) { struct snddev_info *d; struct pcm_channel *ch; @@ -700,7 +700,7 @@ } /* create a new playback channel */ - ch = chn_init(d, parent, &vchan_class, direction, num, parent); + ch = chn_init(d, parent, &vchan_class, direction, parent); if (ch == NULL) { PCM_UNLOCK(d); CHN_LOCK(parent); @@ -933,7 +933,7 @@ } int -vchan_setnew(struct snddev_info *d, int direction, int newcnt, int num) +vchan_setnew(struct snddev_info *d, int direction, int newcnt) { struct pcm_channel *c, *ch, *nch; struct pcmchan_caps *caps; @@ -959,10 +959,9 @@ return (EINVAL); if (newcnt > vcnt) { - KASSERT(num == -1 || - (num >= 0 && num < SND_MAXVCHANS && (newcnt - 1) == vcnt), - ("bogus vchan_create() request num=%d newcnt=%d vcnt=%d", - num, newcnt, vcnt)); + KASSERT((newcnt - 1) == vcnt, + ("bogus vchan_create() request newcnt=%d vcnt=%d", + newcnt, vcnt)); /* add new vchans - find a parent channel first */ ch = NULL; CHN_FOREACH(c, d, channels.pcm) { @@ -1004,7 +1003,7 @@ ch->flags |= CHN_F_BUSY; err = 0; while (err == 0 && newcnt > vcnt) { - err = vchan_create(ch, num); + err = vchan_create(ch); if (err == 0) vcnt++; else if (err == E2BIG && newcnt > vcnt) @@ -1018,8 +1017,6 @@ if (err != 0) return (err); } else if (newcnt < vcnt) { - KASSERT(num == -1, - ("bogus vchan_destroy() request num=%d", num)); CHN_FOREACH(c, d, channels.pcm) { CHN_LOCK(c); if (c->direction != direction || @@ -1061,14 +1058,14 @@ return; if (num >= 0 && d->pvchancount > num) - (void)vchan_setnew(d, PCMDIR_PLAY, num, -1); + (void)vchan_setnew(d, PCMDIR_PLAY, num); else if (num > 0 && d->pvchancount == 0) - (void)vchan_setnew(d, PCMDIR_PLAY, 1, -1); + (void)vchan_setnew(d, PCMDIR_PLAY, 1); if (num >= 0 && d->rvchancount > num) - (void)vchan_setnew(d, PCMDIR_REC, num, -1); + (void)vchan_setnew(d, PCMDIR_REC, num); else if (num > 0 && d->rvchancount == 0) - (void)vchan_setnew(d, PCMDIR_REC, 1, -1); + (void)vchan_setnew(d, PCMDIR_REC, 1); } static int