be38689ca54cbe52ae09fab0da2ea16cf9de8d42
[15.05/openwrt.git] / target / linux / sunxi / patches-3.13 / 117-clk-sunxi-factors_clk_setup_update.patch
1 From 8a3282a0a185108e37e7a48437b58d956ff56f4a Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Emilio=20L=C3=B3pez?= <emilio@elopez.com.ar>
3 Date: Mon, 23 Dec 2013 00:32:36 -0300
4 Subject: [PATCH] clk: sunxi: make factors_clk_setup return the clock it
5  registers
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 We will be needing this to register a factor clock as parent with leaf
11 divisors on a single call.
12
13 Signed-off-by: Emilio López <emilio@elopez.com.ar>
14 Acked-by: Mike Turquette <mturquette@linaro.org>
15 ---
16  drivers/clk/sunxi/clk-sunxi.c | 15 ++++++++-------
17  1 file changed, 8 insertions(+), 7 deletions(-)
18
19 diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
20 index 52f34ec..96ccb3c 100644
21 --- a/drivers/clk/sunxi/clk-sunxi.c
22 +++ b/drivers/clk/sunxi/clk-sunxi.c
23 @@ -317,8 +317,8 @@ struct factors_data {
24         .getter = sun4i_get_apb1_factors,
25  };
26  
27 -static void __init sunxi_factors_clk_setup(struct device_node *node,
28 -                                          struct factors_data *data)
29 +static struct clk * __init sunxi_factors_clk_setup(struct device_node *node,
30 +                                               const struct factors_data *data)
31  {
32         struct clk *clk;
33         struct clk_factors *factors;
34 @@ -340,14 +340,14 @@ static void __init sunxi_factors_clk_setup(struct device_node *node,
35  
36         factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL);
37         if (!factors)
38 -               return;
39 +               return NULL;
40  
41         /* Add a gate if this factor clock can be gated */
42         if (data->enable) {
43                 gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL);
44                 if (!gate) {
45                         kfree(factors);
46 -                       return;
47 +                       return NULL;
48                 }
49  
50                 /* set up gate properties */
51 @@ -363,7 +363,7 @@ static void __init sunxi_factors_clk_setup(struct device_node *node,
52                 if (!mux) {
53                         kfree(factors);
54                         kfree(gate);
55 -                       return;
56 +                       return NULL;
57                 }
58  
59                 /* set up gate properties */
60 @@ -384,13 +384,14 @@ static void __init sunxi_factors_clk_setup(struct device_node *node,
61                         parents, i,
62                         mux_hw, &clk_mux_ops,
63                         &factors->hw, &clk_factors_ops,
64 -                       gate_hw, &clk_gate_ops,
65 -                       i ? 0 : CLK_IS_ROOT);
66 +                       gate_hw, &clk_gate_ops, 0);
67  
68         if (!IS_ERR(clk)) {
69                 of_clk_add_provider(node, of_clk_src_simple_get, clk);
70                 clk_register_clkdev(clk, clk_name, NULL);
71         }
72 +
73 +       return clk;
74  }
75  
76  
77 -- 
78 1.8.5.1
79