mirror of
https://github.com/torvalds/linux
synced 2024-10-15 15:59:15 +00:00
ALSA: control: Introduce snd_ctl_find_id_mixer_locked()
Adds wrapper function snd_ctl_find_id_mixer_locked(). This is identical to snd_ctl_find_id_mixer() except that it can be called from code that is already holding controls_rwsem. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Reviewed-by: Takashi Iwai <tiwai@suse.de> Link: https://msgid.link/r/20240401100210.61277-2-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
2ae143fb3a
commit
08ea486a61
|
@ -167,6 +167,29 @@ snd_ctl_find_id_mixer(struct snd_card *card, const char *name)
|
||||||
return snd_ctl_find_id(card, &id);
|
return snd_ctl_find_id(card, &id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* snd_ctl_find_id_mixer_locked - find the control instance with the given name string
|
||||||
|
* @card: the card instance
|
||||||
|
* @name: the name string
|
||||||
|
*
|
||||||
|
* Finds the control instance with the given name and
|
||||||
|
* @SNDRV_CTL_ELEM_IFACE_MIXER. Other fields are set to zero.
|
||||||
|
*
|
||||||
|
* This is merely a wrapper to snd_ctl_find_id_locked().
|
||||||
|
* The caller must down card->controls_rwsem before calling this function.
|
||||||
|
*
|
||||||
|
* Return: The pointer of the instance if found, or %NULL if not.
|
||||||
|
*/
|
||||||
|
static inline struct snd_kcontrol *
|
||||||
|
snd_ctl_find_id_mixer_locked(struct snd_card *card, const char *name)
|
||||||
|
{
|
||||||
|
struct snd_ctl_elem_id id = {};
|
||||||
|
|
||||||
|
id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
|
||||||
|
strscpy(id.name, name, sizeof(id.name));
|
||||||
|
return snd_ctl_find_id_locked(card, &id);
|
||||||
|
}
|
||||||
|
|
||||||
int snd_ctl_create(struct snd_card *card);
|
int snd_ctl_create(struct snd_card *card);
|
||||||
|
|
||||||
int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn);
|
int snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn);
|
||||||
|
|
Loading…
Reference in a new issue