diff options
author | Takashi Iwai <tiwai@suse.de> | 2023-07-20 10:05:19 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2023-07-20 10:05:19 +0200 |
commit | f056f2fef31e5662e3f995fc23ae0eea27db5a01 (patch) | |
tree | 49cce310d84ef9b8b6973079a3d64be4f267a9a7 /sound/pci/emu10k1 | |
parent | 21634f0f307c8401462da2cd07507880ee17d3fc (diff) | |
parent | 3315cf95834fb5d612f6a5eb718c3620b80dd05e (diff) | |
download | linux-f056f2fef31e5662e3f995fc23ae0eea27db5a01.tar.gz linux-f056f2fef31e5662e3f995fc23ae0eea27db5a01.tar.bz2 linux-f056f2fef31e5662e3f995fc23ae0eea27db5a01.zip |
Merge tag 'tags/ctl-lock-fixes-6.6' into for-next
ALSA: Make control API taking controls_rwsem consistently
A few ALSA control API helpers like snd_ctl_rename(), snd_ctl_remove()
and snd_ctl_find_*() suppose the callers taking card->controls_rwsem.
But it's error-prone and fragile. This patch set tries to change
those API functions to take the card->controls>rwsem internally by
themselves, so that the drivers don't need to take care of lockings.
After applying this patch set, only a couple of places still touch
card->controls_rwsem (which are OK-ish as they need for traversing the
control linked list).
Link: https://lore.kernel.org/r/20230718141304.1032-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/emu10k1')
-rw-r--r-- | sound/pci/emu10k1/emufx.c | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 347141635604..03efc317e05f 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c @@ -793,13 +793,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(emu->card, gctl_id)) { - up_read(&emu->card->controls_rwsem); 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; @@ -971,11 +968,9 @@ static int snd_emu10k1_del_controls(struct snd_emu10k1 *emu, in_kernel); if (err < 0) return err; - down_write(&card->controls_rwsem); ctl = snd_emu10k1_look_for_ctl(emu, &id); if (ctl) snd_ctl_remove(card, ctl->kcontrol); - up_write(&card->controls_rwsem); } return 0; } |