ASoC: dapm: Remove unnecessary loop
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 14 Jun 2013 11:16:52 +0000 (13:16 +0200)
committerMark Brown <broonie@linaro.org>
Fri, 14 Jun 2013 11:34:10 +0000 (12:34 +0100)
The condition 'i == item' is only true when, well, 'i' equals 'item'.
So just use 'item' directly as the index into the array.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/soc-dapm.c

index 9dd2d1d63981a2fe2b1029ffc1d9c5ea34fede06..8d8a8dc6857e038a811af7b6a421319db324500e 100644 (file)
@@ -363,11 +363,10 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
                val = soc_widget_read(w, e->reg);
                item = (val >> e->shift_l) & e->mask;
 
-               p->connect = 0;
-               for (i = 0; i < e->max; i++) {
-                       if (!(strcmp(p->name, e->texts[i])) && item == i)
-                               p->connect = 1;
-               }
+               if (item < e->max && !strcmp(p->name, e->texts[item]))
+                       p->connect = 1;
+               else
+                       p->connect = 0;
        }
        break;
        case snd_soc_dapm_virt_mux: {
@@ -397,11 +396,10 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
                                break;
                }
 
-               p->connect = 0;
-               for (i = 0; i < e->max; i++) {
-                       if (!(strcmp(p->name, e->texts[i])) && item == i)
-                               p->connect = 1;
-               }
+               if (item < e->max && !strcmp(p->name, e->texts[item]))
+                       p->connect = 1;
+               else
+                       p->connect = 0;
        }
        break;
        /* does not affect routing - always connected */