• Takashi Iwai's avatar
    ALSA: control: Introduce unlocked version for snd_ctl_find_*() helpers · b1e055f6
    Takashi Iwai authored
    For reducing the unnecessary use of controls_rwsem in the drivers,
    this patch adds a new variant for snd_ctl_find_*() helpers:
    snd_ctl_find_id_locked() and snd_ctl_find_numid_locked() look for a
    kctl element inside the card->controls_rwsem -- that is, doing the
    very same as what snd_ctl_find_id() and snd_ctl_find_numid() did until
    now.  snd_ctl_find_id() and snd_ctl_find_numid() remain same,
    i.e. still unlocked version, but they will be switched to locked
    version once after all callers are replaced.
    
    The patch also replaces the calls of snd_ctl_find_id() and
    snd_ctl_find_numid() in a few places; all of those are places where we
    know that the functions are called properly with controls_rwsem held.
    All others are without rwsem (although they should have been).
    
    After this patch, we'll turn on the locking in snd_ctl_find_id() and
    snd_ctl_find_numid() to be more race-free.
    
    Link: https://lore.kernel.org/r/20230718141304.1032-10-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    b1e055f6
control_led.c 19.8 KB