]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ALSA: control: Optimize locking for look-up
authorTakashi Iwai <tiwai@suse.de>
Fri, 9 Aug 2024 10:42:30 +0000 (12:42 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 9 Aug 2024 12:24:55 +0000 (14:24 +0200)
commit38ea4c3dc306edf6f4e483e8ad9cb8d33943afde
tree241b50a1da29ca1bafcd5115ca43d3567aec3f38
parentf428cc9eac6e29d57579be4978ba210c344322ea
ALSA: control: Optimize locking for look-up

For a fast look-up of a control element via either numid or name
matching (enabled via CONFIG_SND_CTL_FAST_LOOKUP), a locking isn't
needed at all thanks to Xarray.  OTOH, the locking is still needed for
a slow linked-list traversal, and that's rather a rare case.

In this patch, we reduce the use of locking at snd_ctl_find_*() API
functions, and switch from controls_rwsem to controls_rwlock for
avoiding unnecessary lock inversions.  This also resulted in a nice
cleanup, as *_unlocked() version of snd_ctl_find_*() APIs can be
dropped.

snd_ctl_find_id_mixer_unlocked() is still left just as an alias of
snd_ctl_find_id_mixer(), since soc-card.c has a wrapper and there are
several users.  Once after converting there, we can remove it later.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240809104234.8488-3-tiwai@suse.de
include/sound/control.h
include/sound/core.h
sound/core/control.c
sound/core/control_compat.c
sound/core/control_led.c
sound/core/oss/mixer_oss.c