diff mbox

[v2,2/8] clk: sunxi: choose correct name for multiple output factor clocks

Message ID 1388987892-23733-3-git-send-email-wens@csie.org (mailing list archive)
State New, archived
Headers show

Commit Message

Chen-Yu Tsai Jan. 6, 2014, 5:58 a.m. UTC
Some factor clocks, such as the parent clock of pll5 and pll6, have
multiple output names. Use the last name as the name for the clock
itself.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/clk/sunxi/clk-sunxi.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Maxime Ripard Jan. 7, 2014, 10:16 p.m. UTC | #1
On Mon, Jan 06, 2014 at 01:58:06PM +0800, Chen-Yu Tsai wrote:
> Some factor clocks, such as the parent clock of pll5 and pll6, have
> multiple output names. Use the last name as the name for the clock
> itself.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Mike, Emilio,

This changes the clock names with regard to the previous patches
emilio sent that will be merged in 3.14. It would be great if we could
merge this in 3.14 as well.

Maxime
Maxime Ripard Jan. 7, 2014, 10:41 p.m. UTC | #2
On Tue, Jan 07, 2014 at 11:16:46PM +0100, Maxime Ripard wrote:
> On Mon, Jan 06, 2014 at 01:58:06PM +0800, Chen-Yu Tsai wrote:
> > Some factor clocks, such as the parent clock of pll5 and pll6, have
> > multiple output names. Use the last name as the name for the clock
> > itself.
> > 
> > Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> 
> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> 
> Mike, Emilio,
> 
> This changes the clock names with regard to the previous patches
> emilio sent that will be merged in 3.14. It would be great if we could
> merge this in 3.14 as well.

I've spoken a bit too fast on this, and I'm not really fond of the
patch 7 i've commented on, that depends on what is done in this patch.

We'll see what the outcome of the discussion is.

Maxime
diff mbox

Patch

diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 14a3774..7ce7e1c 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -484,7 +484,7 @@  static struct clk * __init sunxi_factors_clk_setup(struct device_node *node,
 	const char *clk_name = node->name;
 	const char *parents[SUNXI_MAX_PARENTS];
 	void *reg;
-	int i = 0;
+	int j, i = 0;
 
 	reg = of_iomap(node, 0);
 
@@ -493,14 +493,14 @@  static struct clk * __init sunxi_factors_clk_setup(struct device_node *node,
 	       (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
 		i++;
 
-	/* Nodes should be providing the name via clock-output-names
-	 * but originally our dts didn't, and so we used node->name.
-	 * The new, better nodes look like clk@deadbeef, so we pull the
-	 * name just in this case */
-	if (!strcmp("clk", clk_name)) {
-		of_property_read_string_index(node, "clock-output-names",
-					      0, &clk_name);
-	}
+	/*
+	 * factor clocks, such as pll5 and pll6, may have multiple outputs
+	 * Use the last clock output name as this clock's name.
+	 * This matches the behavior of of_clk_get_parent_name()
+	 */
+	j = of_property_count_strings(node, "clock-output-names");
+	of_property_read_string_index(node, "clock-output-names", j - 1,
+				      &clk_name);
 
 	factors = kzalloc(sizeof(struct clk_factors), GFP_KERNEL);
 	if (!factors)