[alsa-devel] [PATCH] ASoC: sta32x: Optimize the array work to find rate_min and rate_max

Johannes Stezenbach js at sig21.net
Tue Jan 3 11:42:50 CET 2012


On Sun, Jan 01, 2012 at 06:36:14PM +0800, Axel Lin wrote:
> 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.

Acked-by: Johannes Stezenbach <js at sig21.net>


Thanks
Johannes


> --- a/sound/soc/codecs/sta32x.c
> +++ b/sound/soc/codecs/sta32x.c
> @@ -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;
>  				}
>  			}
>  		}


More information about the Alsa-devel mailing list