aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Peter Clausen2013-06-14 13:16:52 +0200
committerMark Brown2013-06-14 12:34:10 +0100
commit58fee775b7a18a0174931af6174536560785d500 (patch)
tree95765706c3793454c19a110d35abaabf12a2bdc6
parent6b75bf0c5b17d71c3b0568caaaaae73a22f83826 (diff)
ASoC: dapm: Remove unnecessary loop
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>
-rw-r--r--sound/soc/soc-dapm.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 9dd2d1d63981..8d8a8dc6857e 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -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 */