ALSA: hda - Avoid duplicated path creations
authorTakashi Iwai <tiwai@suse.de>
Fri, 4 Jan 2013 11:56:52 +0000 (12:56 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sat, 12 Jan 2013 07:43:30 +0000 (08:43 +0100)
When the paths are created in map_singles(), we don't have to
re-create new paths in try_assign_dacs().  Just evaluate the badness
and skip to the next item.

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

index 3507448c8b0d88061202c4e8c6cd0d72426eeead..ee2c973f912594d863beadd33ce93ce34deec93d 100644 (file)
@@ -833,8 +833,13 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs,
        for (i = 0; i < num_outs; i++) {
                struct nid_path *path;
                hda_nid_t pin = pins[i];
-               if (!dacs[i])
-                       dacs[i] = look_for_dac(codec, pin, false);
+
+               if (dacs[i]) {
+                       badness += assign_out_path_ctls(codec, pin, dacs[i]);
+                       continue;
+               }
+
+               dacs[i] = look_for_dac(codec, pin, false);
                if (!dacs[i] && !i) {
                        for (j = 1; j < num_outs; j++) {
                                if (is_reachable_path(codec, dacs[j], pin)) {