From nobody Sat May 25 19:31:40 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 4VmsV54BF0z5LTBm; Sat, 25 May 2024 19:31:41 +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 4VmsV46xDsz4jhr; Sat, 25 May 2024 19:31:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716665501; 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=E1BxgcK9UizVUMWg92aO1KUB8qtd+7ijt0gM35tVUqo=; b=akhDgcSzI6sqCvC6QbEw5FyYu7T1Qu2MtXaftjpQc1VieKdbkwsYNioVG6bX6+L7dSroIs yKH/7ZDifak/vWaZzRwi6touytTj7+Qrjbw4E/0LynUdhsTZhWUfbHP/pbT22hX3qO9jr6 xnFCoZVcvQupADxYRDdEHbGSjbfD2sZ7xR47KhK8+3JfW6vA1IUQn+I312MgE9KdLSQ2IY wwLXzyNRvtXCQPHPIxw9X/KDOE6vcXTTbPF0n+bXVImbJdJVdjWzy47gALKzx/PvTdKYZ2 I1DnbFPDLiR7EiPxK7LdKUP1lt7j4mVMxy0vuPeuMEQxuJw8iwIpUwNAZq/fqw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716665501; a=rsa-sha256; cv=none; b=GTmorIHnzFUwopZP5879aTe1+X8DmYF0lBwhXm68X/xdbPKzpfNgKYEzVSi3lHvstp5fzE AmFGNFePfA5bD7KrDpwdcUcnRTZaeRnNFdZHM5lu0+P+XHgMBbU2wuwmmRNwG4gHzh4HYv a9Nw4eGX4jOcWFp7Fcad1pLLFvzcPv5iAGguYsK/GZdESHwnOcPzwp3ulIUzj7+E6UbQUK KMTDZEEnOVNr8StORg5hz9kaCL4ZZ4ExgUGWwn4zMX8wP7tjTd1HvO2zScIjECjBMvyqGf hexcCAY80fSikpuy/SLWtUcDt8oQsVhXFfX4XTvQt2tc20k82WJ5xLIBw8RPXQ== 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=1716665501; 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=E1BxgcK9UizVUMWg92aO1KUB8qtd+7ijt0gM35tVUqo=; b=cGNoazvjVqSwvuFACG1xkWxpFv/7Lm1iAENRyLBwhu/1IQbU2Eg5pRmPO/7qHQLaS6v0Ml 3M7FURw+LiIq9e8YGxJfHejc+THpDJxpT1kic2aDORwUNASmW0hNmkmvcaRGMPjw0tZcj0 VtA1KGpCIQQNbRrtcFh4nJdWZXG7i3m5Z6Suj5v3jMDaf1uS66P7O7kUQ+D3tkBrfEb0Y0 xp0yJxXVk42mmcbSKTJgTGvZKgR70fldP3CU1MiMD08lApGn9V5ykRZHkH1iMy/rmFTkHR skvzEpJWQlx3a1ZC8pYs96jbTGEjzk31YIa4t2/G68scv6b+E0I69zRVLxi7DA== 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 4VmsV46YZXzTPy; Sat, 25 May 2024 19:31:40 +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 44PJVea5043638; Sat, 25 May 2024 19:31:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44PJVe4a043635; Sat, 25 May 2024 19:31:40 GMT (envelope-from git) Date: Sat, 25 May 2024 19:31:40 GMT Message-Id: <202405251931.44PJVe4a043635@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: 0aa767021c19 - stable/14 - sound: Fix minchn, maxchn and fmts in sndstat_get_caps() 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: 0aa767021c19ece8ab5ba99eb65d045700b09869 Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=0aa767021c19ece8ab5ba99eb65d045700b09869 commit 0aa767021c19ece8ab5ba99eb65d045700b09869 Author: Christos Margiolis AuthorDate: 2024-05-23 00:57:55 +0000 Commit: Christos Margiolis CommitDate: 2024-05-25 19:31:26 +0000 sound: Fix minchn, maxchn and fmts in sndstat_get_caps() The current implementation (incorrectly) passes the channel encoding value to AFMT_CHANNEL(), which will always return 0, since the channel number bits are masked out by AFMT_ENCODING(). Also add missing fmts initialization and aggregate encoding formats into it directly. Sponsored by: The FreeBSD Foundation MFC after: 1 day Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D45312 (cherry picked from commit 425a7bc465d4a6393c88c2e79c5ad77befda2a97) --- sys/dev/sound/pcm/sndstat.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/dev/sound/pcm/sndstat.c b/sys/dev/sound/pcm/sndstat.c index bbcb2fda7c29..6880ce383ba4 100644 --- a/sys/dev/sound/pcm/sndstat.c +++ b/sys/dev/sound/pcm/sndstat.c @@ -330,7 +330,6 @@ sndstat_get_caps(struct snddev_info *d, bool play, uint32_t *min_rate, uint32_t *max_rate, uint32_t *fmts, uint32_t *minchn, uint32_t *maxchn) { struct pcm_channel *c; - unsigned int encoding; int dir; dir = play ? PCMDIR_PLAY : PCMDIR_REC; @@ -347,11 +346,11 @@ sndstat_get_caps(struct snddev_info *d, bool play, uint32_t *min_rate, return; } + *fmts = 0; *min_rate = UINT32_MAX; *max_rate = 0; *minchn = UINT32_MAX; *maxchn = 0; - encoding = 0; CHN_FOREACH(c, d, channels.pcm) { struct pcmchan_caps *caps; int i; @@ -364,9 +363,9 @@ sndstat_get_caps(struct snddev_info *d, bool play, uint32_t *min_rate, *min_rate = min(caps->minspeed, *min_rate); *max_rate = max(caps->maxspeed, *max_rate); for (i = 0; caps->fmtlist[i]; i++) { - encoding |= AFMT_ENCODING(caps->fmtlist[i]); - *minchn = min(AFMT_CHANNEL(encoding), *minchn); - *maxchn = max(AFMT_CHANNEL(encoding), *maxchn); + *fmts |= AFMT_ENCODING(caps->fmtlist[i]); + *minchn = min(AFMT_CHANNEL(caps->fmtlist[i]), *minchn); + *maxchn = max(AFMT_CHANNEL(caps->fmtlist[i]), *maxchn); } CHN_UNLOCK(c); }