mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
ALSA: hda: Drop unneeded calculation of index at get_jack_mode_name()
get_jack_mode_name() tries to identify the (potential) index number of the control element to be created, but this index number isn't actually used, since the index is set automatically at instantiating the controls. Drop the unneeded index retrieval and calculation as a cleanup. Along with the change, find_kctl_name() is no longer used, hence drop this function as well. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260730084513.327992-2-tiwai@suse.de
This commit is contained in:
@@ -2695,30 +2695,13 @@ static const struct snd_kcontrol_new out_jack_mode_enum = {
|
||||
.put = out_jack_mode_put,
|
||||
};
|
||||
|
||||
static bool find_kctl_name(struct hda_codec *codec, const char *name, int idx)
|
||||
{
|
||||
struct hda_gen_spec *spec = codec->spec;
|
||||
const struct snd_kcontrol_new *kctl;
|
||||
int i;
|
||||
|
||||
snd_array_for_each(&spec->kctls, i, kctl) {
|
||||
if (!strcmp(kctl->name, name) && kctl->index == idx)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static void get_jack_mode_name(struct hda_codec *codec, hda_nid_t pin,
|
||||
char *name, size_t name_len)
|
||||
{
|
||||
struct hda_gen_spec *spec = codec->spec;
|
||||
int idx = 0;
|
||||
|
||||
snd_hda_get_pin_label(codec, pin, &spec->autocfg, name, name_len, &idx);
|
||||
snd_hda_get_pin_label(codec, pin, &spec->autocfg, name, name_len, NULL);
|
||||
strlcat(name, " Jack Mode", name_len);
|
||||
|
||||
for (; find_kctl_name(codec, name, idx); idx++)
|
||||
;
|
||||
}
|
||||
|
||||
static int get_out_jack_num_items(struct hda_codec *codec, hda_nid_t pin)
|
||||
|
||||
Reference in New Issue
Block a user