1
0
mirror of https://git.FreeBSD.org/src.git synced 2026-06-02 11:24:32 +00:00

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
This commit is contained in:
Christos Margiolis
2026-04-16 14:30:25 +02:00
parent 9a00e0b8ca
commit e87654db5a
+2 -23
View File
@@ -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);
}