Page MenuHomeFreeBSD

sound: Retire mixer_hwvol locked variants
Needs ReviewPublic

Authored by christos on Fri, Aug 21, 12:44 PM.
Tags
None
Referenced Files
F167522110: D59075.id.diff
Sat, Aug 22, 11:18 AM
F167503367: D59075.id184641.diff
Sat, Aug 22, 8:37 AM
F167482038: D59075.diff
Sat, Aug 22, 3:26 AM
Unknown Object (File)
Fri, Aug 21, 1:32 PM
Unknown Object (File)
Fri, Aug 21, 1:13 PM
Subscribers

Details

Reviewers
markj
emaste
kib
Summary

Prior to 9a00e0b8ca56 ("snd_uaudio: Do not use snd_mixer->lock as
mixer_lock"), there was a need for mixer_hwvol_mute_locked() and
mixer_hwvol_step_locked(), because the unlocked variants would acquire
the lock, but uaudio_hid_rx_callback() would also hold the lock, so this
was a measure to avoid recursion on snd_mixer->lock. Now that
snd_uaudio(4) has a private mixer lock, the locked variants are not only
unnecessary, but wrong, because we now lock the private lock and not the
snd_mixer one, which is what mixer_hwvol_mute_locked() and
mixer_hwvol_step_locked() expect. Retire the locked variants and call
the regular functions instead.

The unlocked variants take the mixer lock, which is now the PCM lock,
and reach uaudio_mixer_ctl_set(), which takes mixer_lock. Calling them
straight from uaudio_hid_rx_callback() would therefore take mixer_lock
and the PCM lock in the opposite order to the mixer ioctl path, so
record what the HID report asked for and perform the volume change at
the end of the callback, with mixer_lock dropped. The USB stack allows a
callback to drop its transfer mutex (see usbdi.9).

Sponsored by: The FreeBSD Foundation
MFC after: 1 month

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 75940
Build 72823: arc lint + arc unit