aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2015-10-25 18:21:42 -0400
committerRalf Baechle <ralf@linux-mips.org>2015-10-26 05:55:24 -0400
commit4e7d30dba493b60a80e9b590add1b4402265cc83 (patch)
tree514451ed0ff6a1b9f9a9f298e0333a75e324f817
parentf25319d2cb439249a6859f53ad42ffa332b0acba (diff)
MIPS: lantiq: add clk_round_rate()
This adds a basic implementation of clk_round_rate() The clk_round_rate() function is called by multiple drivers and subsystems now and the lantiq clk driver is supposed to export this, but doesn't do so, this causes linking problems like this one: ERROR: "clk_round_rate" [drivers/media/v4l2-core/videodev.ko] undefined! Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: John Crispin <blogic@openwrt.org> Cc: <stable@vger.kernel.org> # 4.1+ Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/11358/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/lantiq/clk.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/mips/lantiq/clk.c b/arch/mips/lantiq/clk.c
index 3fc2e6d70c77..a0706fd4ce0a 100644
--- a/arch/mips/lantiq/clk.c
+++ b/arch/mips/lantiq/clk.c
@@ -99,6 +99,23 @@ int clk_set_rate(struct clk *clk, unsigned long rate)
99} 99}
100EXPORT_SYMBOL(clk_set_rate); 100EXPORT_SYMBOL(clk_set_rate);
101 101
102long clk_round_rate(struct clk *clk, unsigned long rate)
103{
104 if (unlikely(!clk_good(clk)))
105 return 0;
106 if (clk->rates && *clk->rates) {
107 unsigned long *r = clk->rates;
108
109 while (*r && (*r != rate))
110 r++;
111 if (!*r) {
112 return clk->rate;
113 }
114 }
115 return rate;
116}
117EXPORT_SYMBOL(clk_round_rate);
118
102int clk_enable(struct clk *clk) 119int clk_enable(struct clk *clk)
103{ 120{
104 if (unlikely(!clk_good(clk))) 121 if (unlikely(!clk_good(clk)))