git: a8fc61770121 - stable/14 - sound: Report actual vchanrate and vchanformat in sysctl
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 04 Mar 2025 15:46:57 UTC
The branch stable/14 has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=a8fc617701219d9d466332085381c266e9e686e3
commit a8fc617701219d9d466332085381c266e9e686e3
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-02-25 11:43:33 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-03-04 15:46:05 +0000
sound: Report actual vchanrate and vchanformat in sysctl
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Reviewed by: dev_submerge.ch
Differential Revision: https://reviews.freebsd.org/D48435
(cherry picked from commit d39be38a353323d05744eeb3e08267108e55b9b1)
---
sys/dev/sound/pcm/vchan.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c
index 4ee7e01066d3..b0caec3acfec 100644
--- a/sys/dev/sound/pcm/vchan.c
+++ b/sys/dev/sound/pcm/vchan.c
@@ -497,9 +497,7 @@ sysctl_dev_pcm_vchanrate(SYSCTL_HANDLER_ARGS)
KASSERT(direction == c->direction, ("%s(): invalid direction %d/%d",
__func__, direction, c->direction));
- CHN_LOCK(c);
- newspd = c->speed;
- CHN_UNLOCK(c);
+ newspd = *vchanrate;
ret = sysctl_handle_int(oidp, &newspd, 0, req);
if (ret != 0 || req->newptr == NULL) {
@@ -530,7 +528,6 @@ sysctl_dev_pcm_vchanrate(SYSCTL_HANDLER_ARGS)
ret = chn_reset(c, c->format, newspd);
if (ret == 0) {
- *vchanrate = c->speed;
if (restart != 0) {
CHN_FOREACH(ch, c, children.busy) {
CHN_LOCK(ch);
@@ -543,6 +540,7 @@ sysctl_dev_pcm_vchanrate(SYSCTL_HANDLER_ARGS)
}
}
}
+ *vchanrate = c->speed;
CHN_UNLOCK(c);
@@ -605,15 +603,11 @@ sysctl_dev_pcm_vchanformat(SYSCTL_HANDLER_ARGS)
KASSERT(direction == c->direction, ("%s(): invalid direction %d/%d",
__func__, direction, c->direction));
- CHN_LOCK(c);
-
bzero(fmtstr, sizeof(fmtstr));
- if (snd_afmt2str(c->format, fmtstr, sizeof(fmtstr)) != c->format)
+ if (snd_afmt2str(*vchanformat, fmtstr, sizeof(fmtstr)) != *vchanformat)
strlcpy(fmtstr, "<ERROR>", sizeof(fmtstr));
- CHN_UNLOCK(c);
-
ret = sysctl_handle_string(oidp, fmtstr, sizeof(fmtstr), req);
if (ret != 0 || req->newptr == NULL) {
PCM_RELEASE_QUICK(d);
@@ -637,7 +631,6 @@ sysctl_dev_pcm_vchanformat(SYSCTL_HANDLER_ARGS)
ret = chn_reset(c, newfmt, c->speed);
if (ret == 0) {
- *vchanformat = c->format;
if (restart != 0) {
CHN_FOREACH(ch, c, children.busy) {
CHN_LOCK(ch);
@@ -650,6 +643,7 @@ sysctl_dev_pcm_vchanformat(SYSCTL_HANDLER_ARGS)
}
}
}
+ *vchanformat = c->format;
CHN_UNLOCK(c);