alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: sta32x: Optimize the array work to find rate_min and rate_max
@ 2012-01-01 10:36 Axel Lin
  2012-01-03 10:42 ` Johannes Stezenbach
  2012-01-03 21:18 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Axel Lin @ 2012-01-01 10:36 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown, Liam Girdwood, Lars-Peter Clausen

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.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 sound/soc/codecs/sta32x.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c
index fbd1450..7db6fa5 100644
--- 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;
 				}
 			}
 		}
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: sta32x: Optimize the array work to find rate_min and rate_max
  2012-01-01 10:36 [PATCH] ASoC: sta32x: Optimize the array work to find rate_min and rate_max Axel Lin
@ 2012-01-03 10:42 ` Johannes Stezenbach
  2012-01-03 21:18 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Stezenbach @ 2012-01-03 10:42 UTC (permalink / raw)
  To: Axel Lin
  Cc: alsa-devel, Mark Brown, Sven Neumann, Liam Girdwood,
	Lars-Peter Clausen

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@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;
>  				}
>  			}
>  		}

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: sta32x: Optimize the array work to find rate_min and rate_max
  2012-01-01 10:36 [PATCH] ASoC: sta32x: Optimize the array work to find rate_min and rate_max Axel Lin
  2012-01-03 10:42 ` Johannes Stezenbach
@ 2012-01-03 21:18 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2012-01-03 21:18 UTC (permalink / raw)
  To: Axel Lin; +Cc: alsa-devel, Lars-Peter Clausen, Liam Girdwood

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.

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-03 21:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-01 10:36 [PATCH] ASoC: sta32x: Optimize the array work to find rate_min and rate_max Axel Lin
2012-01-03 10:42 ` Johannes Stezenbach
2012-01-03 21:18 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).