diff options
author | Stephen Boyd <sboyd@codeaurora.org> | 2014-09-05 00:21:50 +0400 |
---|---|---|
committer | Stephen Boyd <sboyd@codeaurora.org> | 2014-09-23 02:16:52 +0400 |
commit | 50c6a50344c58f73c697e2fe38960dc176a2e69f (patch) | |
tree | 013a93a48415beb8abeeebdf7b6919673867ad31 /drivers/clk/qcom/common.c | |
parent | dc1b3f657f25798b2dc9ed8928b80eb3183019a2 (diff) | |
download | linux-50c6a50344c58f73c697e2fe38960dc176a2e69f.tar.xz |
clk: qcom: Consolidate frequency finding logic
There are two find_freq() functions in clk-rcg.c and clk-rcg2.c
that are almost exactly the same. Consolidate them into one
function to save on some code space.
Cc: Mike Turquette <mturquette@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/qcom/common.c')
-rw-r--r-- | drivers/clk/qcom/common.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/clk/qcom/common.c b/drivers/clk/qcom/common.c index eeb3eea01f4c..e20d947db3e5 100644 --- a/drivers/clk/qcom/common.c +++ b/drivers/clk/qcom/common.c @@ -18,6 +18,7 @@ #include <linux/reset-controller.h> #include "common.h" +#include "clk-rcg.h" #include "clk-regmap.h" #include "reset.h" @@ -27,6 +28,21 @@ struct qcom_cc { struct clk *clks[]; }; +const +struct freq_tbl *qcom_find_freq(const struct freq_tbl *f, unsigned long rate) +{ + if (!f) + return NULL; + + for (; f->freq; f++) + if (rate <= f->freq) + return f; + + /* Default to our fastest rate */ + return f - 1; +} +EXPORT_SYMBOL_GPL(qcom_find_freq); + struct regmap * qcom_cc_map(struct platform_device *pdev, const struct qcom_cc_desc *desc) { |