From nobody Fri May 17 19:30:53 2024 X-Original-To: dev-commits-src-all@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 4Vgxrt2g9sz5LgBT; Fri, 17 May 2024 19:30:54 +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 4Vgxrt0FWBz4v45; Fri, 17 May 2024 19:30:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715974254; 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=tanRaRI0FkXJd5M+tFqRJryC9SRGAiLHjtkZsGlVYeU=; b=SooYoFCjiu9uh2UEstjQGrF4UnZ91z1K9e7e+FHOIHiK5vd34p1paV8+yoB7c+aRn4p5dY DtxuEXq5sATGV8PW2JCkkwEcHKvzs83lH+5stwbtafS/YUEopzWjQ2nHFFYYAxPBm+ZgwG vFaTBGRgZ9nEwH2Ssz3LxWYVfjVl6NDgWPvNAOXld3PSs6Yc6kt1Qc6l7fIEpRJOwlaWWy WEjMNR2Rus/lYCcpcH+A080Bk3KodybVP+l38DNRApoAPOk13LI4a9c59GOGcOt4IQpoP7 Bp/OK5jLqfNcNBlhT5Tg1dQOuzlGVs+fHJFJ81irs9QWHkIs5Y2paawrjx6aJA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715974254; a=rsa-sha256; cv=none; b=R18QlYcl6KrxSUAnXn5Qv5/QLAGT1A3rT4Mv5rGD5JtB1SK1lcPR9vos7eEwksE7AbHZ19 Oim/RmNFwSNtMNKkX0bb8nOTJ3XsvLWVpeJRjNWZfSKHXORdE3pbuNEqPXcCw4X4GK5HvH Y12gew+q5/snvbLIfUwobnGvuPUCu600JO1j5b9apa1D3ooDMThQNslzub+tehtFPnkoc7 nAK3yg62Hsr8dbslY9qC6qhqhpwfmxliS00/hnrALFvNfjDPK0StMZmrRENJmtkjaKNVye hQmn4t1cZEcpOgNXl3eP1Kh5z7Hb4KnmQhObw6hVdv1k48xd/JnQhhqZVwek3Q== 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=1715974254; 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=tanRaRI0FkXJd5M+tFqRJryC9SRGAiLHjtkZsGlVYeU=; b=wMlSN3AHFk1yp6GnXsvL1JSxY0Xr4M+dq6zvE5smKWf/vwj6dGnPWoeY9rGVtjsg01v5k6 eMaOJhlQx2NdRes177kp2elq/4iKdO0C9qZLqBLhZLNeDlZmrPY9mfpL0DQJlVvtoeOQl4 W0rSjdSDADLoawnZpzPtOQVKMX8g4BDFr4jKX8RM2josOPan8/w4GvtSGipdpbUDApOioO 4Yl3QJy63ZvV56MqMNDP7/NahxDYMxMtIYmw3wyrGbdHx4xmQapx3bXFhPQCni2K9pTVSE d00tVPcJOOZBJIYN4inZD4g6cAJM3uLJJb9s/oQSFGM+QWTjOCkWElPzWGHcPQ== 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 4Vgxrs1Xqszvy8; Fri, 17 May 2024 19:30:53 +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 44HJUrNx099300; Fri, 17 May 2024 19:30:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44HJUrgb099297; Fri, 17 May 2024 19:30:53 GMT (envelope-from git) Date: Fri, 17 May 2024 19:30:53 GMT Message-Id: <202405171930.44HJUrgb099297@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: 98157281725b - stable/14 - sound: Simplify unit fetching in dsp_oss_audioinfo() List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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: 98157281725b3eed5612753d8150b3edfd01c1b5 Auto-Submitted: auto-generated The branch stable/14 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=98157281725b3eed5612753d8150b3edfd01c1b5 commit 98157281725b3eed5612753d8150b3edfd01c1b5 Author: Christos Margiolis AuthorDate: 2024-04-18 20:35:20 +0000 Commit: Christos Margiolis CommitDate: 2024-05-17 19:30:01 +0000 sound: Simplify unit fetching in dsp_oss_audioinfo() "i" keeps the value of the current unit, so we do not have to call PCMUNIT() and device_get_unit() to fetch it. In the mixer case, I think it is more correct to do it like this, since mixer and DSP device units have a 1-1 relationship (i.e the mixer unit is always the same as the corresponding DSP device one) and that way we can make it more clear. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D44855 (cherry picked from commit a44c45c7f597d67d37e09396b0778a2847a30981) --- sys/dev/sound/pcm/dsp.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index aa6c21f36601..df1482d6a97a 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -2185,7 +2185,7 @@ dsp_oss_audioinfo(struct cdev *i_dev, oss_audioinfo *ai) struct pcm_channel *ch; struct snddev_info *d; uint32_t fmts; - int i, nchan, *rates, minch, maxch; + int i, nchan, *rates, minch, maxch, unit; char *devname, buf[CHN_NAMELEN]; /* @@ -2205,9 +2205,9 @@ dsp_oss_audioinfo(struct cdev *i_dev, oss_audioinfo *ai) * Search for the requested audio device (channel). Start by * iterating over pcm devices. */ - for (i = 0; pcm_devclass != NULL && - i < devclass_get_maxunit(pcm_devclass); i++) { - d = devclass_get_softc(pcm_devclass, i); + for (unit = 0; pcm_devclass != NULL && + unit < devclass_get_maxunit(pcm_devclass); unit++) { + d = devclass_get_softc(pcm_devclass, unit); if (!PCM_REGISTERED(d)) continue; @@ -2332,14 +2332,13 @@ dsp_oss_audioinfo(struct cdev *i_dev, oss_audioinfo *ai) * @todo @c port_number - routing information? */ ai->port_number = -1; - ai->mixer_dev = (d->mixer_dev != NULL) ? PCMUNIT(d->mixer_dev) : -1; + ai->mixer_dev = (d->mixer_dev != NULL) ? unit : -1; /** * @note * @c real_device - OSSv4 docs: "Obsolete." */ ai->real_device = -1; - snprintf(ai->devnode, sizeof(ai->devnode), - "/dev/dsp%d", device_get_unit(d->dev)); + snprintf(ai->devnode, sizeof(ai->devnode), "/dev/dsp%d", unit); ai->enabled = device_is_attached(d->dev) ? 1 : 0; /** * @note