Patchwork [03/10] UBUNTU: SAUCE: dt/clock: add a simple provider get function

login
register
mail settings
Submitter Ike Panhc
Date June 8, 2012, 7:35 a.m.
Message ID <1339140913-10266-1-git-send-email-ike.pan@canonical.com>
Download mbox | patch
Permalink /patch/163722/
State New
Headers show

Comments

Ike Panhc - June 8, 2012, 7:35 a.m.
From: Rob Herring <rob.herring@calxeda.com>

BugLink: http://launchpad.net/bugs/1008345

For simple cases, the clock provider data can simply be the struct clk ptr.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Signed-off-by: Ike Panhc <ike.pan@canonical.com>
---
 drivers/of/clock.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

\ No newline at end of file

Patch

diff --git a/drivers/of/clock.c b/drivers/of/clock.c
index 6ebfc26..7546c94 100644
--- a/drivers/of/clock.c
+++ b/drivers/of/clock.c
@@ -33,6 +33,12 @@  struct of_clk_provider {
 static LIST_HEAD(of_clk_providers);
 static DEFINE_MUTEX(of_clk_lock);
 
+static struct clk *of_clk_simple_get(struct of_phandle_args *clkspec,
+				     void *data)
+{
+	return data;
+}
+
 /**
  * of_clk_add_provider() - Register a clock provider for a node
  * @np: Device node pointer associated with clock provider
@@ -52,7 +58,10 @@  int of_clk_add_provider(struct device_node *np,
 
 	cp->node = of_node_get(np);
 	cp->data = data;
-	cp->get = clk_src_get;
+	if (clk_src_get)
+		cp->get = clk_src_get;
+	else
+		cp->get = of_clk_simple_get;
 
 	mutex_lock(&of_clk_lock);
 	list_add(&cp->link, &of_clk_providers);
@@ -184,11 +193,6 @@  void __init of_clk_init(const struct of_device_id *matches)
 	}
 }
 
-static struct clk *of_fixed_clk_get(struct of_phandle_args *a, void *data)
-{
-	return data;
-}
-
 /**
  * of_fixed_clk_setup() - Setup function for simple fixed rate clock
  */
@@ -205,5 +209,5 @@  void __init of_fixed_clk_setup(struct device_node *node)
 
 	clk = clk_register_fixed_rate(NULL, clk_name, NULL, CLK_IS_ROOT, rate);
 	if (clk)
-		of_clk_add_provider(node, of_fixed_clk_get, clk);
+		of_clk_add_provider(node, NULL, clk);
 }