ar71xx: fix ethernet MAC reset on DMA hang
[openwrt/staging/chunkeey.git] / target / linux / lantiq / patches-4.1 / 0050-MIPS-lantiq-add-clk_round_rate.patch
1 From b3c10c6c19a9a0ad2b967b6afc8d8302ff4e10f9 Mon Sep 17 00:00:00 2001
2 From: Hauke Mehrtens <hauke@hauke-m.de>
3 Date: Sun, 25 Oct 2015 21:47:23 +0100
4 Subject: [PATCH] MIPS: lantiq: add clk_round_rate()
5
6 This adds a basic implementation of clk_round_rate()
7 The clk_round_rate() function is called by multiple drivers and
8 subsystems now and the lantiq clk driver is supposed to export this,
9 but doesn't do so, this causes linking problems like this one:
10 ERROR: "clk_round_rate" [drivers/media/v4l2-core/videodev.ko] undefined!
11
12 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
13 Cc: <stable@vger.kernel.org> # 4.1+
14 ---
15 arch/mips/lantiq/clk.c | 17 +++++++++++++++++
16 1 file changed, 17 insertions(+)
17
18 --- a/arch/mips/lantiq/clk.c
19 +++ b/arch/mips/lantiq/clk.c
20 @@ -116,6 +116,23 @@ long clk_round_rate(struct clk *clk, uns
21 }
22 EXPORT_SYMBOL(clk_round_rate);
23
24 +long clk_round_rate(struct clk *clk, unsigned long rate)
25 +{
26 + if (unlikely(!clk_good(clk)))
27 + return 0;
28 + if (clk->rates && *clk->rates) {
29 + unsigned long *r = clk->rates;
30 +
31 + while (*r && (*r != rate))
32 + r++;
33 + if (!*r) {
34 + return clk->rate;
35 + }
36 + }
37 + return rate;
38 +}
39 +EXPORT_SYMBOL(clk_round_rate);
40 +
41 int clk_enable(struct clk *clk)
42 {
43 if (unlikely(!clk_good(clk)))