summaryrefslogtreecommitdiff
path: root/sound/pci/emu10k1/emufx.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2023-07-18 16:13:02 +0200
committerTakashi Iwai <tiwai@suse.de>2023-07-20 10:03:00 +0200
commitb1e055f67611daf098e27e8731386eeb5257bde3 (patch)
treeb7a4d8ddcbbf6f83a276aada4cc25f919b873f29 /sound/pci/emu10k1/emufx.c
parent6723670a483501497dc339ae37676525245a913a (diff)
ALSA: control: Introduce unlocked version for snd_ctl_find_*() helpers
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.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/emu10k1/emufx.c')
-rw-r--r--sound/pci/emu10k1/emufx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 70c8252a92d9..318a064f2cec 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -800,7 +800,7 @@ static int snd_emu10k1_verify_controls(struct snd_emu10k1 *emu,
continue;
gctl_id = (struct snd_ctl_elem_id *)&gctl->id;
down_read(&emu->card->controls_rwsem);
- if (snd_ctl_find_id(emu->card, gctl_id)) {
+ if (snd_ctl_find_id_locked(emu->card, gctl_id)) {
up_read(&emu->card->controls_rwsem);
err = -EEXIST;
goto __error;