Skip to contentSkip to conversation

ASoC: sta32x: Optimize the array work to find rate_min and rate_max

PATCH Applied Axel Lin 3 participants 3 messages Jan 1, 2012 – Jan 3, 2012

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 ASoC: sta32x: Optimize the array work to find rate_min and rate_max

For a given ir and fs, there is at most one possible match for the case mclk_ratios[ir][j].ratio * fs == freq.
Thus we can break from the inner loop once a match is found.

---
 sound/soc/codecs/sta32x.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
sound/soc/codecs/sta32x.c +1 -0
index fbd1450..7db6fa5 100644
@@ -522,6 +522,7 @@ static int sta32x_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 						rate_min = fs;
 					if (fs > rate_max)
 						rate_max = fs;
+					break;
 				}
 			}
 		}
Signature · 1 line
1.7.5.4
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Axel Lin

For a given ir and fs, there is at most one possible match for the case mclk_ratios[ir][j].ratio * fs == freq.
Thus we can break from the inner loop once a match is found.

Yes, I think this is correct.

Thanks
Johannes

Quoted 10 lines
sound/soc/codecs/sta32x.c +1 -0
@@ -522,6 +522,7 @@ static int sta32x_set_dai_sysclk(struct snd_soc_dai *codec_dai,
 						rate_min = fs;
 					if (fs > rate_max)
 						rate_max = fs;
+					break;
 				}
 			}
 		}
Applied
#2 lore raw
In reply to Axel Lin
Quoted 3 lines · Axel Lin

For a given ir and fs, there is at most one possible match for the case mclk_ratios[ir][j].ratio * fs == freq.
Thus we can break from the inner loop once a match is found.

Applied, thanks.