Page MenuHomeFreeBSD

sound: Use snddev_info->lock in place of snd_mixer->lock
ClosedPublic

Authored by christos on Aug 21 2026, 12:44 PM.
Tags
None
Referenced Files
F174775465: D59074.diff
Mon, Oct 5, 10:26 PM
F174705323: D59074.id.diff
Mon, Oct 5, 8:56 AM
Unknown Object (File)
Sun, Oct 4, 2:33 PM
Unknown Object (File)
Sun, Oct 4, 2:33 PM
Unknown Object (File)
Sun, Oct 4, 3:09 AM
Unknown Object (File)
Sat, Oct 3, 7:24 AM
Unknown Object (File)
Fri, Oct 2, 8:46 PM
Unknown Object (File)
Fri, Oct 2, 7:12 AM
Subscribers

Details

Summary

snd_mixer and snddev_info have a 1:1 relationship. Now that snd_mixer is
embedded into snddev_info, it makes even more sense for both to share
the PCM lock. The only exceptions to this are MIXER_TYPE_SECONDARY
mixers, which still retain a private lock (snd_mixer->priv_lock),
because they are attached to the device driver, and not snddev_info.
Only snd_emu10kx(4) uses a secondary mixer.

A side-effect of this is that the MIXER_SET_LOCK()/MIXER_SET_UNLOCK()
mess goes away. These macros were used in the mixer_set*() functions to
drop the mixer lock if the driver is Giant-locked and the function can
sleep inside MIXER_SET*() methods, and to avoid an LOR before locking
PCM to guard channel list traversal.

Since mixers now use the PCM lock, drop the channel lock in
chn_syncstate() before calling mix_get(), to avoid an LOR. These lines
were actually already commented out for years.

Sponsored by: The FreeBSD Foundation
MFC after: 1 month

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable