From nobody Fri May 17 19:31:10 2024 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VgxsB3tyfz5LgR7; Fri, 17 May 2024 19:31:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VgxsB2rTnz4vZ5; Fri, 17 May 2024 19:31:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715974270; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0EshoxT94u4VppSdJj7+4lzIL+TEI/Vf4QU89UHkflU=; b=l615tQ6ee0eXstynnkvMbhDE74SIB51P7r4Iy6HW1NhK8FaFUuTC+fT0B0FHEWrYf9+wv+ N3XEVZBodIkVEnKOD/wWq6iBafl0Z0/nms+BTzbpU/LqBGMlDKbjgWQP3u7FNFS4Hjveb8 84J/Lf38qA3Wpvvupf+7wwfzamhA6EPVwCM4g4Yi2syp6tYj0uVabEHf18BSBdTyN8EgW1 A03xSPqa8u21FKfEM1Y7GAwm3eDLAeNGTjxvAH4iGHsU6dwu8fA1IQzThO+NgjkmnXvpy2 +Su1zJyt4x9Vr+W1m+d7UIstFLfGVve2UWCX3DEg8jKF4t/o7s+j/rfu+sZyzA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715974270; a=rsa-sha256; cv=none; b=O+fdHKxCOrGYFNg7UDcWCABXUu+79KxoouuxS31U3HhbuGAgvnjotzQg2vDU3r2uwVwDNG +xbMWSYW/bV/67YbZdV/N2Ca/YyijwY0rK3OEgOgkW6U06sxe2vwhtV+epUd8rHyQkxNJ/ 3/vYuGqCyVE72/EXTHDY8VgXDRdVoWQesUbtxIvgIJZ09hng2EMVWKFETzqIhy5gh9U1vQ BJk7df3fUXlsYJ3J2vkScuQa3SSkm2d/M7nnIhSU6Lb+PlTdtZaUB7Uc1338XSnKjCUtGS oBvW9FcVd6NUpJo3j5u+Dcdjm+42hZDWv0/WsSmAX8GAj3WL+myi93NABpsN8A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715974270; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=0EshoxT94u4VppSdJj7+4lzIL+TEI/Vf4QU89UHkflU=; b=dVHvXNkH7e5UOJlFoaBpuvuSyk9bMrdhtVMMRMRdbBMF3Vb4xDnfQ0ySRUW8yN/m5rwUKf lfRlZ89bnJ49F1kqcx68U7YUkORazRGWCbgYLrroZD46YrqKB70Mx9HN17yrAPNyL2v6xc FK1HwrRV49gFiEIv7J57+HoXcv7LxI2CPoiqkCfKqhCE3/FR7STi6+I6PychldKGQUIkNr QZ8t9/lylenA2AtQ3iByw235esMN0+WmZ1fAUUgLCfCHnvRebmyCSVHx64GvDrTtFZH4CO fpQea5SodFSxoUJcnE81EOn0zgezQYLc2hrw4BYZSOGWriSpvlFraqD1DvO9nA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VgxsB2SRJzvTq; Fri, 17 May 2024 19:31:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44HJVAp0000035; Fri, 17 May 2024 19:31:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44HJVAaP000032; Fri, 17 May 2024 19:31:10 GMT (envelope-from git) Date: Fri, 17 May 2024 19:31:10 GMT Message-Id: <202405171931.44HJVAaP000032@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: 17a50abe0e19 - stable/14 - sound: Remove unused "num" argument from chn_init() and related callers List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 17a50abe0e195671bd5079537fcc22c0231572f0 Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=17a50abe0e195671bd5079537fcc22c0231572f0 commit 17a50abe0e195671bd5079537fcc22c0231572f0 Author: Christos Margiolis AuthorDate: 2024-05-06 18:33:11 +0000 Commit: Christos Margiolis CommitDate: 2024-05-17 19:30:35 +0000 sound: Remove unused "num" argument from chn_init() and related callers It is always -1 (i.e unused). Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D45095 (cherry picked from commit 3af2beb8b24ba21fb7e7fbd165a79b8eeff37712) --- sys/dev/sound/pcm/channel.c | 11 ++--------- sys/dev/sound/pcm/channel.h | 2 +- sys/dev/sound/pcm/sound.c | 4 ++-- sys/dev/sound/pcm/vchan.c | 27 ++++++++++++--------------- sys/dev/sound/pcm/vchan.h | 4 ++-- 5 files changed, 19 insertions(+), 29 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index 996cb0cb04f7..846885b9d729 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -1159,7 +1159,7 @@ chn_reset(struct pcm_channel *c, uint32_t fmt, uint32_t spd) 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 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, PCM_BUSYASSERT(d); PCM_LOCKASSERT(d); - KASSERT(num >= -1, ("invalid num=%d", num)); switch (dir) { case PCMDIR_PLAY: @@ -1207,7 +1206,7 @@ chn_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, 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_init(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, 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/channel.h b/sys/dev/sound/pcm/channel.h index 6aca089a7c4d..445882a62f0a 100644 --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -260,7 +260,7 @@ int chn_flush(struct pcm_channel *c); 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/sound.c b/sys/dev/sound/pcm/sound.c index 971054261030..17a7138519ac 100644 --- a/sys/dev/sound/pcm/sound.c +++ b/sys/dev/sound/pcm/sound.c @@ -165,7 +165,7 @@ vchan_alloc: /* 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_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo) 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.c b/sys/dev/sound/pcm/vchan.c index 904ce6661675..8ba8138e55f1 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -339,7 +339,7 @@ sysctl_dev_pcm_vchans(SYSCTL_HANDLER_ARGS) 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 @@ sysctl_dev_pcm_vchanformat(SYSCTL_HANDLER_ARGS) "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 @@ vchan_create(struct pcm_channel *parent, int num) } /* 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 @@ vchan_sync(struct pcm_channel *c) } 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 @@ vchan_setnew(struct snddev_info *d, int direction, int newcnt, int num) 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 @@ vchan_setnew(struct snddev_info *d, int direction, int newcnt, int num) 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 @@ vchan_setnew(struct snddev_info *d, int direction, int newcnt, int num) 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 @@ vchan_setmaxauto(struct snddev_info *d, int num) 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 diff --git a/sys/dev/sound/pcm/vchan.h b/sys/dev/sound/pcm/vchan.h index dcc1d6e9ff32..1f0fa058cf71 100644 --- 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 @@ int vchan_sync(struct pcm_channel *); 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);