CLK: SPEAr: Correct index scanning done for clock synths
authorDeepak Sikri <deepak.sikri@st.com>
Sat, 10 Nov 2012 06:43:46 +0000 (12:13 +0530)
committerMike Turquette <mturquette@linaro.org>
Wed, 21 Nov 2012 19:46:06 +0000 (11:46 -0800)
The patch corrects the case when the rate table is being scanned for a
given frequency, and the search frequency is beyond the maximum
frequency indexed in the table.

By default, the system should be set at max frequency present in the
rate table. This patch correctly returns the corresponding index value.

Signed-off-by: Deepak Sikri <deepak.sikri@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Mike Turquette <mturquette@linaro.org>
drivers/clk/spear/clk.c

index 7cd63788d546d885e70ef2b543c3f1ef93dffe43..628b6d5ed3d96a35b799d55e2467f7970ea5384d 100644 (file)
@@ -32,5 +32,8 @@ long clk_round_rate_index(struct clk_hw *hw, unsigned long drate,
                }
        }
 
+       if ((*index) == rtbl_cnt)
+               (*index)--;
+
        return rate;
 }