ALSA: emu10k1: Go back and simplify with snd_ctl_find_id()
authorTakashi Iwai <tiwai@suse.de>
Tue, 18 Jul 2023 14:13:04 +0000 (16:13 +0200)
committerTakashi Iwai <tiwai@suse.de>
Thu, 20 Jul 2023 08:03:00 +0000 (10:03 +0200)
Now that snd_ctl_find_id() takes the locking itself, we can get rid of
the messy locking in the caller side in snd_emu10k1_verify_controls().

Link: https://lore.kernel.org/r/20230718141304.1032-12-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/emu10k1/emufx.c

index 318a064f2cec3e30febf6adcef0374dfb482a4c5..f114bda25eeaddb5561b23df18c840735e917360 100644 (file)
@@ -799,13 +799,10 @@ static int snd_emu10k1_verify_controls(struct snd_emu10k1 *emu,
                if (snd_emu10k1_look_for_ctl(emu, &gctl->id))
                        continue;
                gctl_id = (struct snd_ctl_elem_id *)&gctl->id;
-               down_read(&emu->card->controls_rwsem);
-               if (snd_ctl_find_id_locked(emu->card, gctl_id)) {
-                       up_read(&emu->card->controls_rwsem);
+               if (snd_ctl_find_id(emu->card, gctl_id)) {
                        err = -EEXIST;
                        goto __error;
                }
-               up_read(&emu->card->controls_rwsem);
                if (gctl_id->iface != SNDRV_CTL_ELEM_IFACE_MIXER &&
                    gctl_id->iface != SNDRV_CTL_ELEM_IFACE_PCM) {
                        err = -EINVAL;