public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
From: Magnus Damm <magnus.damm@gmail.com>
To: linux-clk@vger.kernel.org
Cc: linux-sh@vger.kernel.org,mturquette@baylibre.com,sboyd@codeaurora.org,horms@verge.net.au,geert@linux-m68k.org,laurent.pinchart@ideasonboard.com,Magnus
	Damm <magnus.damm@gmail.com>
Subject: [PATCH 05/05][RFC] clk: fixed-factor: Make use of parent array
Date: Tue, 15 Sep 2015 19:23:26 +0900	[thread overview]
Message-ID: <20150915102326.15716.63028.sendpatchset@little-apple> (raw)
In-Reply-To: <20150915102238.15716.91170.sendpatchset@little-apple>

From: Magnus Damm <damm+renesas@opensource.se>

Extend the fixed-factor-clock code to use the parent array
to pass in the parent clock instead of relying on string
lookup.

This replaces of_clk_get_parent_name() with of_clk_get()
which makes it possible to use a parent clock from a shared DT
node with multiple clock-indices and without clock-output-names.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
---

 drivers/clk/clk-fixed-factor.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

--- 0006/drivers/clk/clk-fixed-factor.c
+++ work/drivers/clk/clk-fixed-factor.c	2015-09-15 18:28:33.410513000 +0900
@@ -8,6 +8,7 @@
  * Standard functionality for the common clock API.
  */
 #include <linux/module.h>
+#include <linux/clk.h>
 #include <linux/clk-provider.h>
 #include <linux/slab.h>
 #include <linux/err.h>
@@ -120,10 +121,11 @@ EXPORT_SYMBOL_GPL(clk_register_fixed_fac
  */
 void __init of_fixed_factor_clk_setup(struct device_node *node)
 {
-	struct clk *clk;
+	struct clk *clk, *parent;
 	const char *clk_name = node->name;
-	const char *parent_name;
+	const char *parent_name = NULL;
 	u32 div, mult;
+	struct clk_init_data init = {};
 
 	if (of_property_read_u32(node, "clock-div", &div)) {
 		pr_err("%s Fixed factor clock <%s> must have a clock-div property\n",
@@ -138,10 +140,14 @@ void __init of_fixed_factor_clk_setup(st
 	}
 
 	of_property_read_string(node, "clock-output-names", &clk_name);
-	parent_name = of_clk_get_parent_name(node, 0);
+	parent = of_clk_get(node, 0);
+
+	init.name = clk_name;
+	init.parents = &parent;
+	init.parent_names = &parent_name;
+
+	clk = clk_register_fixed_factor_init(NULL, &init, mult, div);
 
-	clk = clk_register_fixed_factor(NULL, clk_name, parent_name, 0,
-					mult, div);
 	if (!IS_ERR(clk))
 		of_clk_add_provider(node, of_clk_src_simple_get, clk);
 }

      parent reply	other threads:[~2015-09-15 10:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-15 10:22 [PATCH 00/05][RFC] Clock registration without parent name Magnus Damm
2015-09-15 10:22 ` [PATCH 01/05][RFC] clk: Initialize on-stack struct clk_init_data Magnus Damm
2015-09-15 10:22 ` [PATCH 02/05][RFC] clk: Add parent array to " Magnus Damm
2015-09-15 10:23 ` [PATCH 03/05][RFC] clk: Allow NULL as parent names Magnus Damm
2015-09-15 10:23 ` [PATCH 04/05][RFC] clk: fixed-factor: Pass struct clk_init_data Magnus Damm
2015-09-15 10:23 ` Magnus Damm [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150915102326.15716.63028.sendpatchset@little-apple \
    --to=magnus.damm@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=horms@verge.net.au \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox