Commit 4791c422 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

ASoC: cs35l45: Use new snd_soc_component_get_kcontrol_locked() helper

No longer any need to hard code the addition of the name prefix, use the
new helper function.
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20240802105734.2309788-4-ckeepax@opensource.cirrus.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent c8a132e2
...@@ -176,17 +176,10 @@ static int cs35l45_activate_ctl(struct snd_soc_component *component, ...@@ -176,17 +176,10 @@ static int cs35l45_activate_ctl(struct snd_soc_component *component,
struct snd_kcontrol *kcontrol; struct snd_kcontrol *kcontrol;
struct snd_kcontrol_volatile *vd; struct snd_kcontrol_volatile *vd;
unsigned int index_offset; unsigned int index_offset;
char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
if (component->name_prefix) kcontrol = snd_soc_component_get_kcontrol_locked(component, ctl_name);
snprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, "%s %s",
component->name_prefix, ctl_name);
else
snprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, "%s", ctl_name);
kcontrol = snd_soc_card_get_kcontrol_locked(component->card, name);
if (!kcontrol) { if (!kcontrol) {
dev_err(component->dev, "Can't find kcontrol %s\n", name); dev_err(component->dev, "Can't find kcontrol %s\n", ctl_name);
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment