From 6993ae546defd80467309695fce9ae4a1bcfefbe Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 30 Jul 2026 10:44:32 +0200 Subject: [PATCH] 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 Link: https://patch.msgid.link/20260730084513.327992-2-tiwai@suse.de --- sound/hda/codecs/generic.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/sound/hda/codecs/generic.c b/sound/hda/codecs/generic.c index 660a9f2c0ded..9f6f44cdbe1e 100644 --- a/sound/hda/codecs/generic.c +++ b/sound/hda/codecs/generic.c @@ -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)