Message ID | 20220225082937.2746176-7-s.hauer@pengutronix.de (mailing list archive) |
---|---|
State | Superseded, archived |
Headers | show |
Series | clk: i.MX: PLL14xx: Support dynamic rates | expand |
On 22-02-25 09:29:35, Sascha Hauer wrote: > clk_pll14xx_round_rate() returns the lowest rate by indexing into > the rate table with the variable i. i is actually pll->rate_count > as this is the value we come out of the loop with. Use pll->rate_count > explicitly to make it a bit more clear what is being done. While at > it fix a typo in the comment. No functional change. > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Reviewed-by: Abel Vesa <abel.vesa@nxp.com> > --- > drivers/clk/imx/clk-pll14xx.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c > index b464e1155e25b..af4c979e70a64 100644 > --- a/drivers/clk/imx/clk-pll14xx.c > +++ b/drivers/clk/imx/clk-pll14xx.c > @@ -118,13 +118,13 @@ static long clk_pll14xx_round_rate(struct clk_hw *hw, unsigned long rate, > const struct imx_pll14xx_rate_table *rate_table = pll->rate_table; > int i; > > - /* Assumming rate_table is in descending order */ > + /* Assuming rate_table is in descending order */ > for (i = 0; i < pll->rate_count; i++) > if (rate >= rate_table[i].rate) > return rate_table[i].rate; > > /* return minimum supported value */ > - return rate_table[i - 1].rate; > + return rate_table[pll->rate_count - 1].rate; > } > > static unsigned long clk_pll14xx_recalc_rate(struct clk_hw *hw, > -- > 2.30.2 >
diff --git a/drivers/clk/imx/clk-pll14xx.c b/drivers/clk/imx/clk-pll14xx.c index b464e1155e25b..af4c979e70a64 100644 --- a/drivers/clk/imx/clk-pll14xx.c +++ b/drivers/clk/imx/clk-pll14xx.c @@ -118,13 +118,13 @@ static long clk_pll14xx_round_rate(struct clk_hw *hw, unsigned long rate, const struct imx_pll14xx_rate_table *rate_table = pll->rate_table; int i; - /* Assumming rate_table is in descending order */ + /* Assuming rate_table is in descending order */ for (i = 0; i < pll->rate_count; i++) if (rate >= rate_table[i].rate) return rate_table[i].rate; /* return minimum supported value */ - return rate_table[i - 1].rate; + return rate_table[pll->rate_count - 1].rate; } static unsigned long clk_pll14xx_recalc_rate(struct clk_hw *hw,
clk_pll14xx_round_rate() returns the lowest rate by indexing into the rate table with the variable i. i is actually pll->rate_count as this is the value we come out of the loop with. Use pll->rate_count explicitly to make it a bit more clear what is being done. While at it fix a typo in the comment. No functional change. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> --- drivers/clk/imx/clk-pll14xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)