aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmilio López <emilio@elopez.com.ar>2013-12-22 22:32:36 -0500
committerEmilio López <emilio@elopez.com.ar>2013-12-28 15:08:14 -0500
commit5f4e0be3a72325fbc4d349a847cc9b2edd85b6d2 (patch)
tree9e7527380efe41f1f97ae7ffb65ddc877da40f79
parentd838ff33ec3a6262f44476d8edc0303acdc16580 (diff)
clk: sunxi: make factors_clk_setup return the clock it registers
We will be needing this to register a factor clock as parent with leaf divisors on a single call. Signed-off-by: Emilio López <emilio@elopez.com.ar> Acked-by: Mike Turquette <mturquette@linaro.org>
-rw-r--r--drivers/clk/sunxi/clk-sunxi.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index eeb623bec5ff..31e1fe1d2aea 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -317,8 +317,8 @@ static const struct factors_data sun4i_apb1_data __initconst = {
317 .getter = sun4i_get_apb1_factors, 317 .getter = sun4i_get_apb1_factors,
318}; 318};
319 319
320static void __init sunxi_factors_clk_setup(struct device_node *node, 320static struct clk * __init sunxi_factors_clk_setup(struct device_node *node,
321 struct factors_data *data) 321 const struct factors_data *data)
322{ 322{
323 struct clk *clk; 323 struct clk *clk;
324 struct clk_factors *factors; 324 struct clk_factors *factors;
@@ -340,14 +340,14 @@ static void __init sunxi_factors_clk_setup(struct device_node *node,
340 340
341 factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL); 341 factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL);
342 if (!factors) 342 if (!factors)
343 return; 343 return NULL;
344 344
345 /* Add a gate if this factor clock can be gated */ 345 /* Add a gate if this factor clock can be gated */
346 if (data->enable) { 346 if (data->enable) {
347 gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL); 347 gate = kzalloc(sizeof(struct clk_gate), GFP_KERNEL);
348 if (!gate) { 348 if (!gate) {
349 kfree(factors); 349 kfree(factors);
350 return; 350 return NULL;
351 } 351 }
352 352
353 /* set up gate properties */ 353 /* set up gate properties */
@@ -363,7 +363,7 @@ static void __init sunxi_factors_clk_setup(struct device_node *node,
363 if (!mux) { 363 if (!mux) {
364 kfree(factors); 364 kfree(factors);
365 kfree(gate); 365 kfree(gate);
366 return; 366 return NULL;
367 } 367 }
368 368
369 /* set up gate properties */ 369 /* set up gate properties */
@@ -384,13 +384,14 @@ static void __init sunxi_factors_clk_setup(struct device_node *node,
384 parents, i, 384 parents, i,
385 mux_hw, &clk_mux_ops, 385 mux_hw, &clk_mux_ops,
386 &factors->hw, &clk_factors_ops, 386 &factors->hw, &clk_factors_ops,
387 gate_hw, &clk_gate_ops, 387 gate_hw, &clk_gate_ops, 0);
388 i ? 0 : CLK_IS_ROOT);
389 388
390 if (!IS_ERR(clk)) { 389 if (!IS_ERR(clk)) {
391 of_clk_add_provider(node, of_clk_src_simple_get, clk); 390 of_clk_add_provider(node, of_clk_src_simple_get, clk);
392 clk_register_clkdev(clk, clk_name, NULL); 391 clk_register_clkdev(clk, clk_name, NULL);
393 } 392 }
393
394 return clk;
394} 395}
395 396
396 397