From nobody Mon May 06 18:36:42 2024 X-Original-To: dev-commits-src-main@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 4VY99R2xPkz5J2pC; Mon, 06 May 2024 18:36:43 +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 4VY99R03GYz4snd; Mon, 6 May 2024 18:36:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715020603; 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=W6nFVB3Txw0Dhm5N4k7ZidUhCK0WwAokvMuO1zEBIa0=; b=oSZg4eUuREdM/DmQCmcsVC3joyUB3jyoZrb4kkLOCQln7HAePRQ8QWLXy34oMWGNSMo/Cy fP+jVA2U5PGn6VhDEobedEMXdWs9BrV+sb+8/A3xypTSh9qZPSWG04+TAIT6H8awZGjFhD 8emYuIrR51jGe2mByi7pMl9TWZiJSlHsGH/o48eHikQ8HUekzMF/CuzYPTzR4eny834IWf gAxnkOZnp9st/J/D6e6Vn5x5Yl2AH6vuj0G6NiIv30hdcwB/78HWTx4rm+x1CmhOMLq6cp BCjJYippmrYv4Dmi9Wyjz/Vojzm2QEssi2+IkLUGzqmjHvCvHYHSmZldJGquew== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715020603; a=rsa-sha256; cv=none; b=SKfJ0n9aD1eJolGyiqecRTMiwIXu4OivC4YFLgzb31esJ8FBpEI/ioad3kXAS9NpkdxAP3 sBlmOjfmqAFGUVri4ot3phzy0BHI65G7PRKztmFpg4WQBV5LqSikqPN7B2BFypzo/+MFO4 0Wu9lWO9Q5e4nSEuOspJFw55B/0HeLf/oTHeoucVV22QVT4cpHB2MOlfgYngRTBwtFVYtP qSMij4YMcFD5LhEcTFKqOxjraprDc+xsA1lGl9hPTXXGzeCxxmvoxOBN3sWL4HBTkbc0tP oGkxEVY4IBO2mnlPpMcxkzi+L7UGRIfRdm00Xvknr85QWsitQTsglAmGIE+eWQ== 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=1715020603; 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=W6nFVB3Txw0Dhm5N4k7ZidUhCK0WwAokvMuO1zEBIa0=; b=anQPJX+V0gD7fZ7taSY+8FMY84Skvr+4M83DFZUKxLfaktHWf2VdFt4cRwfO43sxCnvDEV ZY6umZtTBNKfa4mcSA+d+G/FxLS/ScwO8gBnQXdsz2UyxfD6PX6G58Dwldvqbkdq/rT2xL 1boPxWNZdr/TurF8LTww4F5TIU2rODHG4Hh9syoJp7xJEzY4febM2ecA9sbNuv5aEEg3To 4YNjQ7zO5F5/ce3WS8ZAvxuvhjHMzF/AHqz1MKQeWUwHSYUujaMpftHSEEANu4qL3CivSW j9WRv6DM7mHEIT36BZS9IJ4+bAIVifP03lkT0vumj0dedLHev3zYJlqRsQaSwQ== 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 4VY99Q6knnz17wk; Mon, 6 May 2024 18:36:42 +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 446IagAo060422; Mon, 6 May 2024 18:36:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 446Iagon060419; Mon, 6 May 2024 18:36:42 GMT (envelope-from git) Date: Mon, 6 May 2024 18:36:42 GMT Message-Id: <202405061836.446Iagon060419@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Christos Margiolis Subject: git: 3af2beb8b24b - main - sound: Remove unused "num" argument from chn_init() and related callers List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 3af2beb8b24ba21fb7e7fbd165a79b8eeff37712 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=3af2beb8b24ba21fb7e7fbd165a79b8eeff37712 commit 3af2beb8b24ba21fb7e7fbd165a79b8eeff37712 Author: Christos Margiolis AuthorDate: 2024-05-06 18:33:11 +0000 Commit: Christos Margiolis CommitDate: 2024-05-06 18:35:55 +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 --- 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);