diff options
author | Takashi Iwai <tiwai@suse.de> | 2023-07-20 11:05:19 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2023-07-20 11:05:19 +0300 |
commit | f056f2fef31e5662e3f995fc23ae0eea27db5a01 (patch) | |
tree | 49cce310d84ef9b8b6973079a3d64be4f267a9a7 /include/sound | |
parent | 21634f0f307c8401462da2cd07507880ee17d3fc (diff) | |
parent | 3315cf95834fb5d612f6a5eb718c3620b80dd05e (diff) | |
download | linux-f056f2fef31e5662e3f995fc23ae0eea27db5a01.tar.xz |
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 'include/sound')
-rw-r--r-- | include/sound/control.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/include/sound/control.h b/include/sound/control.h index cc3dcc6cfb0f..42e8dbb22d8e 100644 --- a/include/sound/control.h +++ b/include/sound/control.h @@ -140,8 +140,10 @@ int snd_ctl_remove_id(struct snd_card * card, struct snd_ctl_elem_id *id); int snd_ctl_rename_id(struct snd_card * card, struct snd_ctl_elem_id *src_id, struct snd_ctl_elem_id *dst_id); void snd_ctl_rename(struct snd_card *card, struct snd_kcontrol *kctl, const char *name); int snd_ctl_activate_id(struct snd_card *card, struct snd_ctl_elem_id *id, int active); -struct snd_kcontrol *snd_ctl_find_numid(struct snd_card * card, unsigned int numid); -struct snd_kcontrol *snd_ctl_find_id(struct snd_card * card, struct snd_ctl_elem_id *id); +struct snd_kcontrol *snd_ctl_find_numid_locked(struct snd_card *card, unsigned int numid); +struct snd_kcontrol *snd_ctl_find_numid(struct snd_card *card, unsigned int numid); +struct snd_kcontrol *snd_ctl_find_id_locked(struct snd_card *card, const struct snd_ctl_elem_id *id); +struct snd_kcontrol *snd_ctl_find_id(struct snd_card *card, const struct snd_ctl_elem_id *id); int snd_ctl_create(struct snd_card *card); |