summaryrefslogtreecommitdiff
path: root/sound/core/control_led.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2024-08-09 12:42:30 +0200
committerTakashi Iwai <tiwai@suse.de>2024-08-09 14:24:55 +0200
commit38ea4c3dc306edf6f4e483e8ad9cb8d33943afde (patch)
tree241b50a1da29ca1bafcd5115ca43d3567aec3f38 /sound/core/control_led.c
parentf428cc9eac6e29d57579be4978ba210c344322ea (diff)
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
Diffstat (limited to 'sound/core/control_led.c')
-rw-r--r--sound/core/control_led.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/core/control_led.c b/sound/core/control_led.c
index 804805a95e2f..14eb3e6cc94c 100644
--- a/sound/core/control_led.c
+++ b/sound/core/control_led.c
@@ -254,7 +254,7 @@ static int snd_ctl_led_set_id(int card_number, struct snd_ctl_elem_id *id,
if (!card)
return -ENXIO;
guard(rwsem_write)(&card->controls_rwsem);
- kctl = snd_ctl_find_id_locked(card, id);
+ kctl = snd_ctl_find_id(card, id);
if (!kctl)
return -ENOENT;
ioff = snd_ctl_get_ioff(kctl, id);