Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Oct 2024 11:21:29 GMT
From:      Christos Margiolis <christos@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 9834b6fc77ff - stable/14 - sound: Get rid of pnum and max variables in chn_init()
Message-ID:  <202410201121.49KBLTwR061382@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=9834b6fc77ff53e5303d142486de109d6b02219e

commit 9834b6fc77ff53e5303d142486de109d6b02219e
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2024-10-18 08:38:41 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2024-10-20 11:21:04 +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
    
    (cherry picked from commit de8ee333388bf5e551e697b08823b3a6c262f609)
---
 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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202410201121.49KBLTwR061382>