From nobody Thu May 23 00:58:12 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 4Vl8tD5H0qz5LNqc; Thu, 23 May 2024 00:58:12 +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 4Vl8tD42S2z4m7R; Thu, 23 May 2024 00:58:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716425892; 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=r0n4CXbHtTcBLi0TrD5wpkNxokbuQCZrOsuLrkXTPa4=; b=sBq03J3HAv/LREchYEe6kWc3F1oSiIinOLrmrmKD2vBWnd4TNcGJLvKCXwygxjJ2mjMXDl LurqfIXJdiIGG3tKzp9Qc16BX240l224PHCPrUHO84Sk654KerfE9fbrElhS8GepxiJsID gY3qqR98crY5nqhH7pbumQ+CL1kUltkCFnuAsudzTL/Hz8Ey4DxJnM1n5rDb1fmr4hMcu/ YCa3Wf6WAJIdaJiV1IO0XezvuTBAwZeje+9B8rTHYZqAmtUaF3fg97t+LZKANQYNoHEZuW x8hAIySHwcjU7NwdQb5fOsAqvEAhmPjY4Y2UYuFzgQ/n82TXyUICdWJMEf+NKA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716425892; a=rsa-sha256; cv=none; b=VxNJW/5ZX1EOpRUv2ebH1TB00Dc4ZAVTB34tcpeJF1yb8ArDmYQv2fYZhFoays6NjwPklR Sz4gkB5ZCxDf82eMscr3WZmF/EoOK5roz/ECW6ev1hPFawzUWQPqdcMPRfp6nMF3FZxIIW iylnq6/WwaqeSKJyJcsm8tSSMmd5VhP+vVKAQB+USkk88mxjxo5Ryi2rubzhEurxx/rIrb cvauXz1L24xuaCeHEY1ksaGRCcSV+0f2TS8SFhSvEMkeLuZWnd+DervA++ja6obYC8iEqL HJtpm9tUR1UrelvbNmJ78FEo/YgwJz4sj0XQu/UWhKRb3dpz+NOlMPLWgtD5TA== 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=1716425892; 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=r0n4CXbHtTcBLi0TrD5wpkNxokbuQCZrOsuLrkXTPa4=; b=Dj0it7MzQpRhgVf45FESSzJf3CE+fCPglP5G0yEaWksP7ixjS87ouvnetPTrpZvSX/dgf7 LTa7t/tH6eKJHDtLuSCRoalBm10BaNG3XHUafB6lvA0sjKH5NOdbn/UkN6TV5Gsgiz+V9q 10LipmNFjUDfB5kfeaTRE0qblcvkXxHIgA90b3g9s7oBd2hADMCDWpFEBL4mypnnHhQ7kL rjQn+ClJt5uGw/PtOIvAPwNMLYHS4Xk+mynQuJ/KRA22F5ht4C6/euU/OphCKOJ+9kYYUs GRRuLory9eNOd6uQH/5ZtsztZltdLbAHe0F9t8Zgn9zFFjV/EK2d4weJ7lWXpw== 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 4Vl8tD3fK8zSYj; Thu, 23 May 2024 00:58:12 +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 44N0wCpN072125; Thu, 23 May 2024 00:58:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44N0wCaN072122; Thu, 23 May 2024 00:58:12 GMT (envelope-from git) Date: Thu, 23 May 2024 00:58:12 GMT Message-Id: <202405230058.44N0wCaN072122@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: 425a7bc465d4 - main - sound: Fix minchn, maxchn and fmts in sndstat_get_caps() 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: 425a7bc465d4a6393c88c2e79c5ad77befda2a97 Auto-Submitted: auto-generated The branch main has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=425a7bc465d4a6393c88c2e79c5ad77befda2a97 commit 425a7bc465d4a6393c88c2e79c5ad77befda2a97 Author: Christos Margiolis AuthorDate: 2024-05-23 00:57:55 +0000 Commit: Christos Margiolis CommitDate: 2024-05-23 00:57:55 +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 --- 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); }