From nobody Tue Apr 14 10:31:53 2026 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 4fw0vG4s6vz6ZZ0t for ; Tue, 14 Apr 2026 10:31: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 "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4fw0vF6l80z3SQP for ; Tue, 14 Apr 2026 10:31:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1776162713; 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=bVzWdr3LKONaypWO/v53iveYcsfscxGvW6Q6uGPUtq0=; b=fxERsZxl3Nqg05TgHixKMt6/WeMfNLgdpeCVzn257w0HvuZZjHIw/JKnQnxzfPrjv/jiS1 bo1AQ4evEa6G0w/163ZDOTN2E/YaLu9pVlr11A+UDAALIkb62BEEFPAOaAKFUQNfH91vpJ vi20sXUe8vAXumO08OojxIAH0Pp5Oj7KrJpx2m40oqfO9gz0PIMZnuLGu2SJPuHvOLpxt8 WTlzd8KxSsyFSvQ+6eIxxn668BsNoh0faHdxUvwhPuQJM4qwGCX8MJDR/GuiWd6F+d8C/0 kaBXPansavk0RxFm5jHI/SGWAyoh0W2TDxOR78PWI5ce8CgtzwkBVjzAldSutg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1776162713; a=rsa-sha256; cv=none; b=lM3SSw/pzt33TwZNXw7qdoUwTCR+5gembi030WwjJXTRVRhtW7lwWAvBV0F0birJNlGrZ4 gmu6w2tNRmf2vocBJSX5acDDMrQ4KvQlN1Vcxb9w2adHG4uDt7A5oRyrhFdVjca8MqZK1o kN4jue2g41IN/hA63h6jK5iFkDUc4B052or6oVcYxbimJ2NKdfkFHP30vCev0+BlM/k3WH HRVbFnlXOxVdlFJL8+vl8X0x8zX0CqHQb/WzfvUpVQc9Ne1pqgRKSYenlodQd12espmvVb cg94y2uxAC/KD2rZbw36+fEcWZ4kmb9L3RXWVirsOM1VXBmov8tjhI4ETPWnDQ== 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=1776162713; 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=bVzWdr3LKONaypWO/v53iveYcsfscxGvW6Q6uGPUtq0=; b=eSnpat7EfAEx2TzlH+rJ40itejRXPtkoS3Tnfwa8CH0TrRt9/dtipRgh3L9l44ADwGfOCE txqhfFjGEQE71959yOprFNQlAJMW02frbHzaofssL0+n5zmUfyXNiM6V2hpg8lNNCPFW7u 0Vekunco9xb6ai8R64iH3z+vCVB9eWRjIa0j5M6Qs+pXF+6ZZdaPeydYv8tdhw5TuItYKs NKg7gM453xd9TFg7eZSMSOYQcKW/jy3IWZLCSdhlt8WMXzW68aKE+3p0CDmXormqO/Di7h xftq7O/OOYjOeRqIZbhW2A7FD8TToPThvSxxqCoIYBXbw5LdMXxnoPmn6BJ6tw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fw0vF6FnDzmky for ; Tue, 14 Apr 2026 10:31:53 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 30120 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 14 Apr 2026 10:31:53 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: 6e5c351e785d - stable/15 - sound: Simplify parts of chn_notify() 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/15 X-Git-Reftype: branch X-Git-Commit: 6e5c351e785d2f42d087f1f4adaad8bc0e4f9765 Auto-Submitted: auto-generated Date: Tue, 14 Apr 2026 10:31:53 +0000 Message-Id: <69de1799.30120.233dad76@gitrepo.freebsd.org> The branch stable/15 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=6e5c351e785d2f42d087f1f4adaad8bc0e4f9765 commit 6e5c351e785d2f42d087f1f4adaad8bc0e4f9765 Author: Christos Margiolis AuthorDate: 2026-04-07 15:44:29 +0000 Commit: Christos Margiolis CommitDate: 2026-04-14 10:31:43 +0000 sound: Simplify parts of chn_notify() Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D56240 (cherry picked from commit 8b18fc456bb136112e166508a9182718cdd44be2) --- sys/dev/sound/pcm/channel.c | 47 +++++++++++++++++++-------------------------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index c9edce27c8cd..9b71d93ac7f9 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -2349,7 +2349,7 @@ chn_notify(struct pcm_channel *c, u_int32_t flags) * If the hwchan is running, we can't change its rate, format or * blocksize */ - run = (CHN_STARTED(c)) ? 1 : 0; + run = CHN_STARTED(c); if (run) flags &= CHN_N_TRIGGER; @@ -2360,16 +2360,17 @@ chn_notify(struct pcm_channel *c, u_int32_t flags) chn_setlatency(c, chn_latency); } - if ((flags & CHN_N_TRIGGER) && !(c->flags & CHN_F_VCHAN_DYNAMIC)) { - nrun = CHN_EMPTY(c, children.busy) ? 0 : 1; - if (nrun && !run) - err = chn_start(c, 1); - if (!nrun && run) - chn_abort(c); - flags &= ~CHN_N_TRIGGER; - } - if (flags & CHN_N_TRIGGER) { + if (!(c->flags & CHN_F_VCHAN_DYNAMIC)) { + nrun = !CHN_EMPTY(c, children.busy); + if (nrun && !run) + err = chn_start(c, 1); + if (!nrun && run) + chn_abort(c); + + return (err); + } + if (c->direction == PCMDIR_PLAY) { vchanformat = &c->parentsnddev->pvchanformat; vchanrate = &c->parentsnddev->pvchanrate; @@ -2378,7 +2379,6 @@ chn_notify(struct pcm_channel *c, u_int32_t flags) vchanrate = &c->parentsnddev->rvchanrate; } - /* Dynamic Virtual Channel */ if (!(c->flags & CHN_F_VCHAN_ADAPTIVE)) { bestformat = *vchanformat; bestspeed = *vchanrate; @@ -2394,6 +2394,7 @@ chn_notify(struct pcm_channel *c, u_int32_t flags) vpflags = 0; CHN_FOREACH(ch, c, children.busy) { + nrun++; CHN_LOCK(ch); if ((ch->format & AFMT_PASSTHROUGH) && snd_fmtvalid(ch->format, caps->fmtlist)) { @@ -2401,7 +2402,6 @@ chn_notify(struct pcm_channel *c, u_int32_t flags) bestspeed = ch->speed; CHN_UNLOCK(ch); vpflags = CHN_F_PASSTHROUGH; - nrun++; break; } if ((ch->flags & CHN_F_EXCLUSIVE) && vpflags == 0) { @@ -2416,13 +2416,11 @@ chn_notify(struct pcm_channel *c, u_int32_t flags) } CHN_UNLOCK(ch); vpflags = CHN_F_EXCLUSIVE; - nrun++; continue; } if (!(c->flags & CHN_F_VCHAN_ADAPTIVE) || vpflags != 0) { CHN_UNLOCK(ch); - nrun++; continue; } if (ch->speed > bestspeed) { @@ -2433,7 +2431,6 @@ chn_notify(struct pcm_channel *c, u_int32_t flags) besthwformat = snd_fmtbest(ch->format, caps->fmtlist); if (!(besthwformat & AFMT_VCHAN)) { CHN_UNLOCK(ch); - nrun++; continue; } if (AFMT_CHANNEL(besthwformat) > @@ -2444,7 +2441,6 @@ chn_notify(struct pcm_channel *c, u_int32_t flags) AFMT_BIT(besthwformat) > AFMT_BIT(bestformat)) bestformat = besthwformat; CHN_UNLOCK(ch); - nrun++; } if (bestformat == 0) @@ -2464,17 +2460,16 @@ chn_notify(struct pcm_channel *c, u_int32_t flags) c->devinfo, bestspeed); err = chn_reset(c, bestformat, bestspeed); } - if (err == 0 && dirty) { - CHN_FOREACH(ch, c, children.busy) { - CHN_LOCK(ch); - if (VCHAN_SYNC_REQUIRED(ch)) - vchan_sync(ch); - CHN_UNLOCK(ch); - } - } if (err == 0) { - if (dirty) + if (dirty) { + CHN_FOREACH(ch, c, children.busy) { + CHN_LOCK(ch); + if (VCHAN_SYNC_REQUIRED(ch)) + vchan_sync(ch); + CHN_UNLOCK(ch); + } c->flags |= CHN_F_DIRTY; + } err = chn_start(c, 1); } } @@ -2491,8 +2486,6 @@ chn_notify(struct pcm_channel *c, u_int32_t flags) vchan_sync(ch); CHN_UNLOCK(ch); } - } - if (err == 0) { c->flags |= CHN_F_DIRTY; err = chn_start(c, 1); }