git: de8ee333388b - main - sound: Get rid of pnum and max variables in chn_init()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 18 Oct 2024 08:44:50 UTC
The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=de8ee333388bf5e551e697b08823b3a6c262f609 commit de8ee333388bf5e551e697b08823b3a6c262f609 Author: Christos Margiolis <christos@FreeBSD.org> AuthorDate: 2024-10-18 08:38:41 +0000 Commit: Christos Margiolis <christos@FreeBSD.org> CommitDate: 2024-10-18 08:38:41 +0000 sound: Get rid of pnum and max variables in chn_init() The VCHAN count is checked in vchan_setnew(), and there is no reason to cap the hardware channels in the first place. This is part of a series of follow-up patches. Sponsored by: The FreeBSD Foundation MFC after: 2 days Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D46521 --- sys/dev/sound/pcm/channel.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index e0fd24805a21..bf9c74e2ed1d 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1165,7 +1165,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, struct feeder_class *fc; struct snd_dbuf *b, *bs; char *dirs, buf[CHN_NAMELEN]; - int i, direction, *pnum, max, type, unit; + int i, direction, type, unit; PCM_BUSYASSERT(d); PCM_LOCKASSERT(d); @@ -1174,30 +1174,22 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, case PCMDIR_PLAY: dirs = "play"; direction = PCMDIR_PLAY; - pnum = &d->playcount; type = SND_DEV_DSPHW_PLAY; - max = SND_MAXHWCHAN; break; case PCMDIR_PLAY_VIRTUAL: dirs = "virtual_play"; direction = PCMDIR_PLAY; - pnum = &d->pvchancount; type = SND_DEV_DSPHW_VPLAY; - max = SND_MAXVCHANS; break; case PCMDIR_REC: dirs = "record"; direction = PCMDIR_REC; - pnum = &d->reccount; type = SND_DEV_DSPHW_REC; - max = SND_MAXHWCHAN; break; case PCMDIR_REC_VIRTUAL: dirs = "virtual_record"; direction = PCMDIR_REC; - pnum = &d->rvchancount; type = SND_DEV_DSPHW_VREC; - max = SND_MAXVCHANS; break; default: device_printf(d->dev, @@ -1206,23 +1198,11 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, return (NULL); } - if (*pnum >= max) { - device_printf(d->dev, "%s(): cannot allocate more channels " - "(max=%d)\n", __func__, max); - return (NULL); - } - unit = 0; CHN_FOREACH(c, d, channels.pcm) { if (c->type != type) continue; unit++; - if (unit >= max) { - device_printf(d->dev, "%s(): cannot allocate more " - "channels for type=%d (max=%d)\n", - __func__, type, max); - return (NULL); - } } PCM_UNLOCK(d);