ALSA: hda - Allow slave controls with non-zero indices
authorTakashi Iwai <tiwai@suse.de>
Fri, 6 Mar 2009 09:08:14 +0000 (10:08 +0100)
committerTakashi Iwai <tiwai@suse.de>
Fri, 6 Mar 2009 09:08:14 +0000 (10:08 +0100)
Fix snd_hda_add_vmaster() to check the non-zero indices of slave controls.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c

index 04cb1251e3e7baaf2d52f43c7fbcde770e23ce17..1885e7649101786014dfcf96eb3184952b278bd4 100644 (file)
@@ -1552,15 +1552,20 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name,
        
        for (s = slaves; *s; s++) {
                struct snd_kcontrol *sctl;
-
-               sctl = snd_hda_find_mixer_ctl(codec, *s);
-               if (!sctl) {
-                       snd_printdd("Cannot find slave %s, skipped\n", *s);
-                       continue;
+               int i = 0;
+               for (;;) {
+                       sctl = _snd_hda_find_mixer_ctl(codec, *s, i);
+                       if (!sctl) {
+                               if (!i)
+                                       snd_printdd("Cannot find slave %s, "
+                                                   "skipped\n", *s);
+                               break;
+                       }
+                       err = snd_ctl_add_slave(kctl, sctl);
+                       if (err < 0)
+                               return err;
+                       i++;
                }
-               err = snd_ctl_add_slave(kctl, sctl);
-               if (err < 0)
-                       return err;
        }
        return 0;
 }