git: e87654db5a09 - main - snd_uaudio: Stop using mixer_get_lock()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 27 May 2026 15:33:32 UTC
The branch main has been updated by christos:
URL: https://cgit.FreeBSD.org/src/commit/?id=e87654db5a0923856afbaace9bd0975331782044
commit e87654db5a0923856afbaace9bd0975331782044
Author: Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2026-04-16 12:30:25 +0000
Commit: Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-05-27 15:32:11 +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
---
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);
}