git: d80356b7525b - stable/15 - snd_uaudio: Stop using mixer_get_lock()

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Wed, 03 Jun 2026 08:23:28 UTC
The branch stable/15 has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=d80356b7525b2d07fc192635489c74480a683e3c

commit d80356b7525b2d07fc192635489c74480a683e3c
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-04-16 12:30:25 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-06-03 08:23:03 +0000

    snd_uaudio: Stop using mixer_get_lock()
    
    There is no reason to lock snd_mixer->lock here, since the only thing we
    are doing with snd_mixer is to call mix_getdevinfo() and mix_get_dev(),
    which are one-line getters, which are needed to eventually call
    uaudio_get_child_index_by_dev().
    
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/18
    
    (cherry picked from commit e87654db5a0923856afbaace9bd0975331782044)
---
 sys/dev/sound/usb/uaudio_pcm.c | 25 ++-----------------------
 1 file changed, 2 insertions(+), 23 deletions(-)

diff --git a/sys/dev/sound/usb/uaudio_pcm.c b/sys/dev/sound/usb/uaudio_pcm.c
index c24c111f983c..4b1762cfc3ec 100644
--- a/sys/dev/sound/usb/uaudio_pcm.c
+++ b/sys/dev/sound/usb/uaudio_pcm.c
@@ -134,39 +134,18 @@ ua_mixer_init(struct snd_mixer *m)
 static int
 ua_mixer_set(struct snd_mixer *m, unsigned type, unsigned left, unsigned right)
 {
-	struct mtx *mtx = mixer_get_lock(m);
-	uint8_t do_unlock;
-
-	if (mtx_owned(mtx)) {
-		do_unlock = 0;
-	} else {
-		do_unlock = 1;
-		mtx_lock(mtx);
-	}
 	uaudio_mixer_set(mix_getdevinfo(m), m, type, left, right);
-	if (do_unlock) {
-		mtx_unlock(mtx);
-	}
+
 	return (left | (right << 8));
 }
 
 static uint32_t
 ua_mixer_setrecsrc(struct snd_mixer *m, uint32_t src)
 {
-	struct mtx *mtx = mixer_get_lock(m);
 	int retval;
-	uint8_t do_unlock;
 
-	if (mtx_owned(mtx)) {
-		do_unlock = 0;
-	} else {
-		do_unlock = 1;
-		mtx_lock(mtx);
-	}
 	retval = uaudio_mixer_setrecsrc(mix_getdevinfo(m), m, src);
-	if (do_unlock) {
-		mtx_unlock(mtx);
-	}
+
 	return (retval);
 }