Commit a595238b authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

ASoC: sta32x: shortcut the for loop to get ir and mcs

There is exactly one match or no match at all during the for loop iteration,
thus we can break from the for loop once a match is found.
Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Acked-by: default avatarJohannes Stezenbach <js@sig21.net>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 1f9099b4
...@@ -524,13 +524,17 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream, ...@@ -524,13 +524,17 @@ static int sta32x_hw_params(struct snd_pcm_substream *substream,
rate = params_rate(params); rate = params_rate(params);
pr_debug("rate: %u\n", rate); pr_debug("rate: %u\n", rate);
for (i = 0; i < ARRAY_SIZE(interpolation_ratios); i++) for (i = 0; i < ARRAY_SIZE(interpolation_ratios); i++)
if (interpolation_ratios[i].fs == rate) if (interpolation_ratios[i].fs == rate) {
ir = interpolation_ratios[i].ir; ir = interpolation_ratios[i].ir;
break;
}
if (ir < 0) if (ir < 0)
return -EINVAL; return -EINVAL;
for (i = 0; mclk_ratios[ir][i].ratio; i++) for (i = 0; mclk_ratios[ir][i].ratio; i++)
if (mclk_ratios[ir][i].ratio * rate == sta32x->mclk) if (mclk_ratios[ir][i].ratio * rate == sta32x->mclk) {
mcs = mclk_ratios[ir][i].mcs; mcs = mclk_ratios[ir][i].mcs;
break;
}
if (mcs < 0) if (mcs < 0)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment