All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] clk: make use of of_clk_parent_fill helper function
@ 2015-06-10 21:49 dinguyen
  2015-06-10 21:49 ` [PATCH 1/6] clk: at91: " dinguyen
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: dinguyen @ 2015-06-10 21:49 UTC (permalink / raw)
  To: sboyd, mturquette
  Cc: dinh.linux, linux-clk, linux-kernel, Dinh Nguyen, Tero Kristo,
	Maxime Ripard, Emilio López, Peter Griffin,
	Gabriel FERNANDEZ, Santosh Shilimkar, Boris Brezillon

From: Dinh Nguyen <dinguyen@opensource.altera.com>

Hello,

This patch series makes use of the new of_clk_parent_fill() helper function.
This patch series is not intended for v4.2, as I think it's a bit late, but
I just wanted to make sure people have time to test it. The series is based
on git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux.git#clk-next.

Thank,

Dinh Nguyen (6):
  clk: at91: make use of of_clk_parent_fill helper function
  clk: qoriq: make use of of_clk_parent_fill helper function
  clk: keystone: make use of of_clk_parent_fill helper function
  clk: st: make use of of_clk_parent_fill helper function
  clk: sunxi: make use of of_clk_parent_fill helper function
  clk: ti: make use of of_clk_parent_fill helper function

 drivers/clk/at91/clk-main.c         |  7 +------
 drivers/clk/at91/clk-master.c       |  7 +------
 drivers/clk/at91/clk-programmable.c |  7 +------
 drivers/clk/at91/clk-slow.c         | 14 ++------------
 drivers/clk/at91/clk-smd.c          |  7 +------
 drivers/clk/at91/clk-usb.c          |  7 +------
 drivers/clk/clk-qoriq.c             |  5 ++---
 drivers/clk/keystone/pll.c          |  3 +--
 drivers/clk/st/clk-flexgen.c        |  6 ++----
 drivers/clk/st/clkgen-mux.c         |  7 ++-----
 drivers/clk/sunxi/clk-a20-gmac.c    |  3 +--
 drivers/clk/sunxi/clk-factors.c     |  4 +---
 drivers/clk/sunxi/clk-sun6i-ar100.c |  3 +--
 drivers/clk/sunxi/clk-sunxi.c       | 10 ++--------
 drivers/clk/ti/apll.c               |  4 +---
 drivers/clk/ti/composite.c          |  4 +---
 drivers/clk/ti/dpll.c               |  4 +---
 drivers/clk/ti/fapll.c              |  3 +--
 drivers/clk/ti/mux.c                |  4 +---
 19 files changed, 24 insertions(+), 85 deletions(-)
---
Cc: Tero Kristo <t-kristo@ti.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: "Emilio López" <emilio@elopez.com.ar>
Cc: Peter Griffin <peter.griffin@linaro.org>
Cc: Gabriel FERNANDEZ <gabriel.fernandez@st.com>
Cc: Santosh Shilimkar <ssantosh@kernel.org>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>

-- 
2.2.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/6] clk: at91: make use of of_clk_parent_fill helper function
  2015-06-10 21:49 [PATCH 0/6] clk: make use of of_clk_parent_fill helper function dinguyen
@ 2015-06-10 21:49 ` dinguyen
  2015-06-10 21:49 ` [PATCH 2/6] clk: qoriq: " dinguyen
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: dinguyen @ 2015-06-10 21:49 UTC (permalink / raw)
  To: sboyd, mturquette
  Cc: dinh.linux, linux-clk, linux-kernel, Dinh Nguyen, Boris Brezillon

From: Dinh Nguyen <dinguyen@opensource.altera.com>

Use of_clk_parent_fill to fill in the parent clock names' array.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Boris Brezillon <boris.brezillon@free-electrons.com>
---
 drivers/clk/at91/clk-main.c         |  7 +------
 drivers/clk/at91/clk-master.c       |  7 +------
 drivers/clk/at91/clk-programmable.c |  7 +------
 drivers/clk/at91/clk-slow.c         | 14 ++------------
 drivers/clk/at91/clk-smd.c          |  7 +------
 drivers/clk/at91/clk-usb.c          |  7 +------
 6 files changed, 7 insertions(+), 42 deletions(-)

diff --git a/drivers/clk/at91/clk-main.c b/drivers/clk/at91/clk-main.c
index c240045..13f481b 100644
--- a/drivers/clk/at91/clk-main.c
+++ b/drivers/clk/at91/clk-main.c
@@ -612,17 +612,12 @@ void __init of_at91sam9x5_clk_main_setup(struct device_node *np,
 	int num_parents;
 	unsigned int irq;
 	const char *name = np->name;
-	int i;
 
 	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > 2)
 		return;
 
-	for (i = 0; i < num_parents; ++i) {
-		parent_names[i] = of_clk_get_parent_name(np, i);
-		if (!parent_names[i])
-			return;
-	}
+	of_clk_parent_fill(np, parent_names, num_parents);
 
 	of_property_read_string(np, "clock-output-names", &name);
 
diff --git a/drivers/clk/at91/clk-master.c b/drivers/clk/at91/clk-master.c
index f98eafe..38f646d 100644
--- a/drivers/clk/at91/clk-master.c
+++ b/drivers/clk/at91/clk-master.c
@@ -218,7 +218,6 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc,
 {
 	struct clk *clk;
 	int num_parents;
-	int i;
 	unsigned int irq;
 	const char *parent_names[MASTER_SOURCE_MAX];
 	const char *name = np->name;
@@ -228,11 +227,7 @@ of_at91_clk_master_setup(struct device_node *np, struct at91_pmc *pmc,
 	if (num_parents <= 0 || num_parents > MASTER_SOURCE_MAX)
 		return;
 
-	for (i = 0; i < num_parents; ++i) {
-		parent_names[i] = of_clk_get_parent_name(np, i);
-		if (!parent_names[i])
-			return;
-	}
+	of_clk_parent_fill(np, parent_names, num_parents);
 
 	of_property_read_string(np, "clock-output-names", &name);
 
diff --git a/drivers/clk/at91/clk-programmable.c b/drivers/clk/at91/clk-programmable.c
index 8c86c0f..21492ac 100644
--- a/drivers/clk/at91/clk-programmable.c
+++ b/drivers/clk/at91/clk-programmable.c
@@ -230,7 +230,6 @@ of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc,
 {
 	int num;
 	u32 id;
-	int i;
 	struct clk *clk;
 	int num_parents;
 	const char *parent_names[PROG_SOURCE_MAX];
@@ -241,11 +240,7 @@ of_at91_clk_prog_setup(struct device_node *np, struct at91_pmc *pmc,
 	if (num_parents <= 0 || num_parents > PROG_SOURCE_MAX)
 		return;
 
-	for (i = 0; i < num_parents; ++i) {
-		parent_names[i] = of_clk_get_parent_name(np, i);
-		if (!parent_names[i])
-			return;
-	}
+	of_clk_parent_fill(np, parent_names, num_parents);
 
 	num = of_get_child_count(np);
 	if (!num || num > (PROG_ID_MAX + 1))
diff --git a/drivers/clk/at91/clk-slow.c b/drivers/clk/at91/clk-slow.c
index 98a84a8..84c19d7 100644
--- a/drivers/clk/at91/clk-slow.c
+++ b/drivers/clk/at91/clk-slow.c
@@ -371,17 +371,12 @@ void __init of_at91sam9x5_clk_slow_setup(struct device_node *np,
 	const char *parent_names[2];
 	int num_parents;
 	const char *name = np->name;
-	int i;
 
 	num_parents = of_clk_get_parent_count(np);
 	if (num_parents <= 0 || num_parents > 2)
 		return;
 
-	for (i = 0; i < num_parents; ++i) {
-		parent_names[i] = of_clk_get_parent_name(np, i);
-		if (!parent_names[i])
-			return;
-	}
+	of_clk_parent_fill(np, parent_names, num_parents);
 
 	of_property_read_string(np, "clock-output-names", &name);
 
@@ -449,17 +444,12 @@ void __init of_at91sam9260_clk_slow_setup(struct device_node *np,
 	const char *parent_names[2];
 	int num_parents;
 	const char *name = np->name;
-	int i;
 
 	num_parents = of_clk_get_parent_count(np);
 	if (num_parents != 2)
 		return;
 
-	for (i = 0; i < num_parents; ++i) {
-		parent_names[i] = of_clk_get_parent_name(np, i);
-		if (!parent_names[i])
-			return;
-	}
+	of_clk_parent_fill(np, parent_names, num_parents);
 
 	of_property_read_string(np, "clock-output-names", &name);
 
diff --git a/drivers/clk/at91/clk-smd.c b/drivers/clk/at91/clk-smd.c
index 3817ea8..a7f8501 100644
--- a/drivers/clk/at91/clk-smd.c
+++ b/drivers/clk/at91/clk-smd.c
@@ -145,7 +145,6 @@ void __init of_at91sam9x5_clk_smd_setup(struct device_node *np,
 					struct at91_pmc *pmc)
 {
 	struct clk *clk;
-	int i;
 	int num_parents;
 	const char *parent_names[SMD_SOURCE_MAX];
 	const char *name = np->name;
@@ -154,11 +153,7 @@ void __init of_at91sam9x5_clk_smd_setup(struct device_node *np,
 	if (num_parents <= 0 || num_parents > SMD_SOURCE_MAX)
 		return;
 
-	for (i = 0; i < num_parents; i++) {
-		parent_names[i] = of_clk_get_parent_name(np, i);
-		if (!parent_names[i])
-			return;
-	}
+	of_clk_parent_fill(np, parent_names, num_parents);
 
 	of_property_read_string(np, "clock-output-names", &name);
 
diff --git a/drivers/clk/at91/clk-usb.c b/drivers/clk/at91/clk-usb.c
index b0cbd2b..b3cbf45 100644
--- a/drivers/clk/at91/clk-usb.c
+++ b/drivers/clk/at91/clk-usb.c
@@ -373,7 +373,6 @@ void __init of_at91sam9x5_clk_usb_setup(struct device_node *np,
 					struct at91_pmc *pmc)
 {
 	struct clk *clk;
-	int i;
 	int num_parents;
 	const char *parent_names[USB_SOURCE_MAX];
 	const char *name = np->name;
@@ -382,11 +381,7 @@ void __init of_at91sam9x5_clk_usb_setup(struct device_node *np,
 	if (num_parents <= 0 || num_parents > USB_SOURCE_MAX)
 		return;
 
-	for (i = 0; i < num_parents; i++) {
-		parent_names[i] = of_clk_get_parent_name(np, i);
-		if (!parent_names[i])
-			return;
-	}
+	of_clk_parent_fill(np, parent_names, num_parents);
 
 	of_property_read_string(np, "clock-output-names", &name);
 
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/6] clk: qoriq: make use of of_clk_parent_fill helper function
  2015-06-10 21:49 [PATCH 0/6] clk: make use of of_clk_parent_fill helper function dinguyen
  2015-06-10 21:49 ` [PATCH 1/6] clk: at91: " dinguyen
@ 2015-06-10 21:49 ` dinguyen
  2015-06-10 21:49 ` [PATCH 3/6] clk: keystone: " dinguyen
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: dinguyen @ 2015-06-10 21:49 UTC (permalink / raw)
  To: sboyd, mturquette; +Cc: dinh.linux, linux-clk, linux-kernel, Dinh Nguyen

From: Dinh Nguyen <dinguyen@opensource.altera.com>

Use of_clk_parent_fill to fill in the parent clock names' array.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
---
 drivers/clk/clk-qoriq.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk-qoriq.c b/drivers/clk/clk-qoriq.c
index cda90a9..d3f4570 100644
--- a/drivers/clk/clk-qoriq.c
+++ b/drivers/clk/clk-qoriq.c
@@ -70,7 +70,7 @@ static void __init core_mux_init(struct device_node *np)
 	struct clk_init_data init;
 	struct cmux_clk *cmux_clk;
 	struct device_node *node;
-	int rc, count, i;
+	int rc, count;
 	u32	offset;
 	const char *clk_name;
 	const char **parent_names;
@@ -92,8 +92,7 @@ static void __init core_mux_init(struct device_node *np)
 	if (!parent_names)
 		return;
 
-	for (i = 0; i < count; i++)
-		parent_names[i] = of_clk_get_parent_name(np, i);
+	of_clk_parent_fill(np, parent_names, count);
 
 	cmux_clk = kzalloc(sizeof(*cmux_clk), GFP_KERNEL);
 	if (!cmux_clk)
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/6] clk: keystone: make use of of_clk_parent_fill helper function
  2015-06-10 21:49 [PATCH 0/6] clk: make use of of_clk_parent_fill helper function dinguyen
  2015-06-10 21:49 ` [PATCH 1/6] clk: at91: " dinguyen
  2015-06-10 21:49 ` [PATCH 2/6] clk: qoriq: " dinguyen
@ 2015-06-10 21:49 ` dinguyen
  2015-06-10 22:14   ` santosh shilimkar
  2015-06-10 21:49 ` [PATCH 4/6] clk: st: " dinguyen
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: dinguyen @ 2015-06-10 21:49 UTC (permalink / raw)
  To: sboyd, mturquette
  Cc: dinh.linux, linux-clk, linux-kernel, Dinh Nguyen, Santosh Shilimkar

From: Dinh Nguyen <dinguyen@opensource.altera.com>

Use of_clk_parent_fill to fill in the parent clock names' array.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Santosh Shilimkar <ssantosh@kernel.org>
---
 drivers/clk/keystone/pll.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c
index 0dd8a4b..d885372 100644
--- a/drivers/clk/keystone/pll.c
+++ b/drivers/clk/keystone/pll.c
@@ -293,8 +293,7 @@ static void __init of_pll_mux_clk_init(struct device_node *node)
 		return;
 	}
 
-	parents[0] = of_clk_get_parent_name(node, 0);
-	parents[1] = of_clk_get_parent_name(node, 1);
+	of_clk_parent_fill(node, parents, 2);
 	if (!parents[0] || !parents[1]) {
 		pr_err("%s: missing parent clocks\n", __func__);
 		return;
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/6] clk: st: make use of of_clk_parent_fill helper function
  2015-06-10 21:49 [PATCH 0/6] clk: make use of of_clk_parent_fill helper function dinguyen
                   ` (2 preceding siblings ...)
  2015-06-10 21:49 ` [PATCH 3/6] clk: keystone: " dinguyen
@ 2015-06-10 21:49 ` dinguyen
  2015-06-11  7:37   ` Gabriel Fernandez
  2015-06-10 21:49 ` [PATCH 5/6] clk: sunxi: " dinguyen
  2015-06-10 21:49 ` [PATCH 6/6] clk: ti: " dinguyen
  5 siblings, 1 reply; 11+ messages in thread
From: dinguyen @ 2015-06-10 21:49 UTC (permalink / raw)
  To: sboyd, mturquette
  Cc: dinh.linux, linux-clk, linux-kernel, Dinh Nguyen, Peter Griffin,
	Gabriel FERNANDEZ

From: Dinh Nguyen <dinguyen@opensource.altera.com>

Use of_clk_parent_fill to fill in the parent clock names' array.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Peter Griffin <peter.griffin@linaro.org>
Cc: Gabriel FERNANDEZ <gabriel.fernandez@st.com>
---
 drivers/clk/st/clk-flexgen.c | 6 ++----
 drivers/clk/st/clkgen-mux.c  | 7 ++-----
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c
index 657ca14..ed0696c 100644
--- a/drivers/clk/st/clk-flexgen.c
+++ b/drivers/clk/st/clk-flexgen.c
@@ -243,7 +243,7 @@ static const char ** __init flexgen_get_parents(struct device_node *np,
 						       int *num_parents)
 {
 	const char **parents;
-	int nparents, i;
+	int nparents;
 
 	nparents = of_clk_get_parent_count(np);
 	if (WARN_ON(nparents <= 0))
@@ -253,10 +253,8 @@ static const char ** __init flexgen_get_parents(struct device_node *np,
 	if (!parents)
 		return NULL;
 
-	for (i = 0; i < nparents; i++)
-		parents[i] = of_clk_get_parent_name(np, i);
+	*num_parents = of_clk_parent_fill(np, parents, nparents);
 
-	*num_parents = nparents;
 	return parents;
 }
 
diff --git a/drivers/clk/st/clkgen-mux.c b/drivers/clk/st/clkgen-mux.c
index 4fbe6e0..b83654a 100644
--- a/drivers/clk/st/clkgen-mux.c
+++ b/drivers/clk/st/clkgen-mux.c
@@ -24,7 +24,7 @@ static const char ** __init clkgen_mux_get_parents(struct device_node *np,
 						       int *num_parents)
 {
 	const char **parents;
-	int nparents, i;
+	int nparents;
 
 	nparents = of_clk_get_parent_count(np);
 	if (WARN_ON(nparents <= 0))
@@ -34,10 +34,7 @@ static const char ** __init clkgen_mux_get_parents(struct device_node *np,
 	if (!parents)
 		return ERR_PTR(-ENOMEM);
 
-	for (i = 0; i < nparents; i++)
-		parents[i] = of_clk_get_parent_name(np, i);
-
-	*num_parents = nparents;
+	*num_parents = of_clk_parent_fill(np, parents, nparents);
 	return parents;
 }
 
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/6] clk: sunxi: make use of of_clk_parent_fill helper function
  2015-06-10 21:49 [PATCH 0/6] clk: make use of of_clk_parent_fill helper function dinguyen
                   ` (3 preceding siblings ...)
  2015-06-10 21:49 ` [PATCH 4/6] clk: st: " dinguyen
@ 2015-06-10 21:49 ` dinguyen
  2015-06-11  9:06   ` Maxime Ripard
  2015-06-10 21:49 ` [PATCH 6/6] clk: ti: " dinguyen
  5 siblings, 1 reply; 11+ messages in thread
From: dinguyen @ 2015-06-10 21:49 UTC (permalink / raw)
  To: sboyd, mturquette
  Cc: dinh.linux, linux-clk, linux-kernel, Dinh Nguyen, Maxime Ripard,
	Emilio López

From: Dinh Nguyen <dinguyen@opensource.altera.com>

Use of_clk_parent_fill to fill in the parent clock names' array.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: "Emilio López" <emilio@elopez.com.ar>
---
 drivers/clk/sunxi/clk-a20-gmac.c    |  3 +--
 drivers/clk/sunxi/clk-factors.c     |  4 +---
 drivers/clk/sunxi/clk-sun6i-ar100.c |  3 +--
 drivers/clk/sunxi/clk-sunxi.c       | 10 ++--------
 4 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/drivers/clk/sunxi/clk-a20-gmac.c b/drivers/clk/sunxi/clk-a20-gmac.c
index 0dcf4f2..a432edd 100644
--- a/drivers/clk/sunxi/clk-a20-gmac.c
+++ b/drivers/clk/sunxi/clk-a20-gmac.c
@@ -80,8 +80,7 @@ static void __init sun7i_a20_gmac_clk_setup(struct device_node *node)
 		goto free_mux;
 
 	/* gmac clock requires exactly 2 parents */
-	parents[0] = of_clk_get_parent_name(node, 0);
-	parents[1] = of_clk_get_parent_name(node, 1);
+	of_clk_parent_fill(node, parents, 2);
 	if (!parents[0] || !parents[1])
 		goto free_gate;
 
diff --git a/drivers/clk/sunxi/clk-factors.c b/drivers/clk/sunxi/clk-factors.c
index 8c20190..2589457 100644
--- a/drivers/clk/sunxi/clk-factors.c
+++ b/drivers/clk/sunxi/clk-factors.c
@@ -174,9 +174,7 @@ struct clk *sunxi_factors_register(struct device_node *node,
 	int i = 0;
 
 	/* if we have a mux, we will have >1 parents */
-	while (i < FACTORS_MAX_PARENTS &&
-	       (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
-		i++;
+	i = of_clk_parent_fill(node, parents, FACTORS_MAX_PARENTS);
 
 	/*
 	 * some factor clocks, such as pll5 and pll6, may have multiple
diff --git a/drivers/clk/sunxi/clk-sun6i-ar100.c b/drivers/clk/sunxi/clk-sun6i-ar100.c
index 63cf149..6f229ff 100644
--- a/drivers/clk/sunxi/clk-sun6i-ar100.c
+++ b/drivers/clk/sunxi/clk-sun6i-ar100.c
@@ -195,8 +195,7 @@ static int sun6i_a31_ar100_clk_probe(struct platform_device *pdev)
 	if (nparents > SUN6I_AR100_MAX_PARENTS)
 		nparents = SUN6I_AR100_MAX_PARENTS;
 
-	for (i = 0; i < nparents; i++)
-		parents[i] = of_clk_get_parent_name(np, i);
+	of_clk_parent_fill(np, parents, nparents);
 
 	of_property_read_string(np, "clock-output-names", &clk_name);
 
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 7e1e2bd..ebea294 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -200,10 +200,7 @@ static void __init sun6i_ahb1_clk_setup(struct device_node *node)
 	reg = of_io_request_and_map(node, 0, of_node_full_name(node));
 
 	/* we have a mux, we will have >1 parents */
-	while (i < SUN6I_AHB1_MAX_PARENTS &&
-	       (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
-		i++;
-
+	of_clk_parent_fill(node, parents, SUN6I_AHB1_MAX_PARENTS);
 	of_property_read_string(node, "clock-output-names", &clk_name);
 
 	ahb1 = kzalloc(sizeof(struct sun6i_ahb1_clk), GFP_KERNEL);
@@ -788,10 +785,7 @@ static void __init sunxi_mux_clk_setup(struct device_node *node,
 
 	reg = of_iomap(node, 0);
 
-	while (i < SUNXI_MAX_PARENTS &&
-	       (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
-		i++;
-
+	of_clk_parent_fill(node, parents, SUNXI_MAX_PARENTS);
 	of_property_read_string(node, "clock-output-names", &clk_name);
 
 	clk = clk_register_mux(NULL, clk_name, parents, i,
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6/6] clk: ti: make use of of_clk_parent_fill helper function
  2015-06-10 21:49 [PATCH 0/6] clk: make use of of_clk_parent_fill helper function dinguyen
                   ` (4 preceding siblings ...)
  2015-06-10 21:49 ` [PATCH 5/6] clk: sunxi: " dinguyen
@ 2015-06-10 21:49 ` dinguyen
  5 siblings, 0 replies; 11+ messages in thread
From: dinguyen @ 2015-06-10 21:49 UTC (permalink / raw)
  To: sboyd, mturquette
  Cc: dinh.linux, linux-clk, linux-kernel, Dinh Nguyen, Tero Kristo

From: Dinh Nguyen <dinguyen@opensource.altera.com>

Use of_clk_parent_fill to fill in the parent clock names' array.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Cc: Tero Kristo <t-kristo@ti.com>
---
 drivers/clk/ti/apll.c      | 4 +---
 drivers/clk/ti/composite.c | 4 +---
 drivers/clk/ti/dpll.c      | 4 +---
 drivers/clk/ti/fapll.c     | 3 +--
 drivers/clk/ti/mux.c       | 4 +---
 5 files changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/clk/ti/apll.c b/drivers/clk/ti/apll.c
index 49baf38..523880e 100644
--- a/drivers/clk/ti/apll.c
+++ b/drivers/clk/ti/apll.c
@@ -170,7 +170,6 @@ static void __init of_dra7_apll_setup(struct device_node *node)
 	struct clk_hw_omap *clk_hw = NULL;
 	struct clk_init_data *init = NULL;
 	const char **parent_names = NULL;
-	int i;
 
 	ad = kzalloc(sizeof(*ad), GFP_KERNEL);
 	clk_hw = kzalloc(sizeof(*clk_hw), GFP_KERNEL);
@@ -195,8 +194,7 @@ static void __init of_dra7_apll_setup(struct device_node *node)
 	if (!parent_names)
 		goto cleanup;
 
-	for (i = 0; i < init->num_parents; i++)
-		parent_names[i] = of_clk_get_parent_name(node, i);
+	of_clk_parent_fill(node, parent_names, init->num_parents);
 
 	init->parent_names = parent_names;
 
diff --git a/drivers/clk/ti/composite.c b/drivers/clk/ti/composite.c
index 96f83ce..dbef218 100644
--- a/drivers/clk/ti/composite.c
+++ b/drivers/clk/ti/composite.c
@@ -276,7 +276,6 @@ int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw,
 	int num_parents;
 	const char **parent_names;
 	struct component_clk *clk;
-	int i;
 
 	num_parents = of_clk_get_parent_count(node);
 
@@ -289,8 +288,7 @@ int __init ti_clk_add_component(struct device_node *node, struct clk_hw *hw,
 	if (!parent_names)
 		return -ENOMEM;
 
-	for (i = 0; i < num_parents; i++)
-		parent_names[i] = of_clk_get_parent_name(node, i);
+	of_clk_parent_fill(node, parent_names, num_parents);
 
 	clk = kzalloc(sizeof(*clk), GFP_KERNEL);
 	if (!clk) {
diff --git a/drivers/clk/ti/dpll.c b/drivers/clk/ti/dpll.c
index 2aacf7a..49acdf2 100644
--- a/drivers/clk/ti/dpll.c
+++ b/drivers/clk/ti/dpll.c
@@ -341,7 +341,6 @@ static void __init of_ti_dpll_setup(struct device_node *node,
 	struct clk_init_data *init = NULL;
 	const char **parent_names = NULL;
 	struct dpll_data *dd = NULL;
-	int i;
 	u8 dpll_mode = 0;
 
 	dd = kzalloc(sizeof(*dd), GFP_KERNEL);
@@ -370,8 +369,7 @@ static void __init of_ti_dpll_setup(struct device_node *node,
 	if (!parent_names)
 		goto cleanup;
 
-	for (i = 0; i < init->num_parents; i++)
-		parent_names[i] = of_clk_get_parent_name(node, i);
+	of_clk_parent_fill(node, parent_names, init->num_parents);
 
 	init->parent_names = parent_names;
 
diff --git a/drivers/clk/ti/fapll.c b/drivers/clk/ti/fapll.c
index 730aa62..b1c741b 100644
--- a/drivers/clk/ti/fapll.c
+++ b/drivers/clk/ti/fapll.c
@@ -558,8 +558,7 @@ static void __init ti_fapll_setup(struct device_node *node)
 		goto free;
 	}
 
-	parent_name[0] = of_clk_get_parent_name(node, 0);
-	parent_name[1] = of_clk_get_parent_name(node, 1);
+	of_clk_parent_fill(node, parent_name, 2);
 	init->parent_names = parent_name;
 
 	fd->clk_ref = of_clk_get(node, 0);
diff --git a/drivers/clk/ti/mux.c b/drivers/clk/ti/mux.c
index 5cdeed5..99fe27e 100644
--- a/drivers/clk/ti/mux.c
+++ b/drivers/clk/ti/mux.c
@@ -190,7 +190,6 @@ static void of_mux_clk_setup(struct device_node *node)
 	void __iomem *reg;
 	int num_parents;
 	const char **parent_names;
-	int i;
 	u8 clk_mux_flags = 0;
 	u32 mask = 0;
 	u32 shift = 0;
@@ -205,8 +204,7 @@ static void of_mux_clk_setup(struct device_node *node)
 	if (!parent_names)
 		goto cleanup;
 
-	for (i = 0; i < num_parents; i++)
-		parent_names[i] = of_clk_get_parent_name(node, i);
+	of_clk_parent_fill(node, parent_names, num_parents);
 
 	reg = ti_clk_get_reg_addr(node, 0);
 
-- 
2.2.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/6] clk: keystone: make use of of_clk_parent_fill helper function
  2015-06-10 21:49 ` [PATCH 3/6] clk: keystone: " dinguyen
@ 2015-06-10 22:14   ` santosh shilimkar
  0 siblings, 0 replies; 11+ messages in thread
From: santosh shilimkar @ 2015-06-10 22:14 UTC (permalink / raw)
  To: dinguyen, sboyd, mturquette
  Cc: dinh.linux, linux-clk, linux-kernel, Santosh Shilimkar

On 6/10/2015 2:49 PM, dinguyen@opensource.altera.com wrote:
> From: Dinh Nguyen <dinguyen@opensource.altera.com>
>
> Use of_clk_parent_fill to fill in the parent clock names' array.
>
> Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
> Cc: Santosh Shilimkar <ssantosh@kernel.org>
> ---
>   drivers/clk/keystone/pll.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
Looks fine by me.
Acked-by: Santosh Shilimkar <ssantosh@kernel.org>


> diff --git a/drivers/clk/keystone/pll.c b/drivers/clk/keystone/pll.c
> index 0dd8a4b..d885372 100644
> --- a/drivers/clk/keystone/pll.c
> +++ b/drivers/clk/keystone/pll.c
> @@ -293,8 +293,7 @@ static void __init of_pll_mux_clk_init(struct device_node *node)
>   		return;
>   	}
>
> -	parents[0] = of_clk_get_parent_name(node, 0);
> -	parents[1] = of_clk_get_parent_name(node, 1);
> +	of_clk_parent_fill(node, parents, 2);
>   	if (!parents[0] || !parents[1]) {
>   		pr_err("%s: missing parent clocks\n", __func__);
>   		return;
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/6] clk: st: make use of of_clk_parent_fill helper function
  2015-06-10 21:49 ` [PATCH 4/6] clk: st: " dinguyen
@ 2015-06-11  7:37   ` Gabriel Fernandez
  0 siblings, 0 replies; 11+ messages in thread
From: Gabriel Fernandez @ 2015-06-11  7:37 UTC (permalink / raw)
  To: dinguyen, sboyd, mturquette
  Cc: dinh.linux, linux-clk, linux-kernel, Peter Griffin

Hi

Tested-by Gabriel Fernandez <gabriel.fernandez@st.com>

Best Regards.

On 06/10/2015 11:49 PM, dinguyen@opensource.altera.com wrote:
> From: Dinh Nguyen <dinguyen@opensource.altera.com>
>
> Use of_clk_parent_fill to fill in the parent clock names' array.
>
> Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
> Cc: Peter Griffin <peter.griffin@linaro.org>
> Cc: Gabriel FERNANDEZ <gabriel.fernandez@st.com>
> ---
>   drivers/clk/st/clk-flexgen.c | 6 ++----
>   drivers/clk/st/clkgen-mux.c  | 7 ++-----
>   2 files changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/clk/st/clk-flexgen.c b/drivers/clk/st/clk-flexgen.c
> index 657ca14..ed0696c 100644
> --- a/drivers/clk/st/clk-flexgen.c
> +++ b/drivers/clk/st/clk-flexgen.c
> @@ -243,7 +243,7 @@ static const char ** __init flexgen_get_parents(struct device_node *np,
>   						       int *num_parents)
>   {
>   	const char **parents;
> -	int nparents, i;
> +	int nparents;
>   
>   	nparents = of_clk_get_parent_count(np);
>   	if (WARN_ON(nparents <= 0))
> @@ -253,10 +253,8 @@ static const char ** __init flexgen_get_parents(struct device_node *np,
>   	if (!parents)
>   		return NULL;
>   
> -	for (i = 0; i < nparents; i++)
> -		parents[i] = of_clk_get_parent_name(np, i);
> +	*num_parents = of_clk_parent_fill(np, parents, nparents);
>   
> -	*num_parents = nparents;
>   	return parents;
>   }
>   
> diff --git a/drivers/clk/st/clkgen-mux.c b/drivers/clk/st/clkgen-mux.c
> index 4fbe6e0..b83654a 100644
> --- a/drivers/clk/st/clkgen-mux.c
> +++ b/drivers/clk/st/clkgen-mux.c
> @@ -24,7 +24,7 @@ static const char ** __init clkgen_mux_get_parents(struct device_node *np,
>   						       int *num_parents)
>   {
>   	const char **parents;
> -	int nparents, i;
> +	int nparents;
>   
>   	nparents = of_clk_get_parent_count(np);
>   	if (WARN_ON(nparents <= 0))
> @@ -34,10 +34,7 @@ static const char ** __init clkgen_mux_get_parents(struct device_node *np,
>   	if (!parents)
>   		return ERR_PTR(-ENOMEM);
>   
> -	for (i = 0; i < nparents; i++)
> -		parents[i] = of_clk_get_parent_name(np, i);
> -
> -	*num_parents = nparents;
> +	*num_parents = of_clk_parent_fill(np, parents, nparents);
>   	return parents;
>   }
>   


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/6] clk: sunxi: make use of of_clk_parent_fill helper function
  2015-06-10 21:49 ` [PATCH 5/6] clk: sunxi: " dinguyen
@ 2015-06-11  9:06   ` Maxime Ripard
  2015-06-11 19:55     ` Dinh Nguyen
  0 siblings, 1 reply; 11+ messages in thread
From: Maxime Ripard @ 2015-06-11  9:06 UTC (permalink / raw)
  To: dinguyen
  Cc: sboyd, mturquette, dinh.linux, linux-clk, linux-kernel,
	Emilio López

[-- Attachment #1: Type: text/plain, Size: 1487 bytes --]

Hi Dinh,

On Wed, Jun 10, 2015 at 04:49:24PM -0500, dinguyen@opensource.altera.com wrote:
> From: Dinh Nguyen <dinguyen@opensource.altera.com>
> 
> Use of_clk_parent_fill to fill in the parent clock names' array.
> 
> Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
> Cc: "Emilio López" <emilio@elopez.com.ar>
> ---
>  drivers/clk/sunxi/clk-a20-gmac.c    |  3 +--
>  drivers/clk/sunxi/clk-factors.c     |  4 +---
>  drivers/clk/sunxi/clk-sun6i-ar100.c |  3 +--
>  drivers/clk/sunxi/clk-sunxi.c       | 10 ++--------
>  4 files changed, 5 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/clk/sunxi/clk-a20-gmac.c b/drivers/clk/sunxi/clk-a20-gmac.c
> index 0dcf4f2..a432edd 100644
> --- a/drivers/clk/sunxi/clk-a20-gmac.c
> +++ b/drivers/clk/sunxi/clk-a20-gmac.c
> @@ -80,8 +80,7 @@ static void __init sun7i_a20_gmac_clk_setup(struct device_node *node)
>  		goto free_mux;
>  
>  	/* gmac clock requires exactly 2 parents */
> -	parents[0] = of_clk_get_parent_name(node, 0);
> -	parents[1] = of_clk_get_parent_name(node, 1);
> +	of_clk_parent_fill(node, parents, 2);
>  	if (!parents[0] || !parents[1])

Maybe this check can be changed to something like:

if (of_clk_parent_fill(node, parents, 2) != 2)
   goto free_gate;

Would that make sense?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 5/6] clk: sunxi: make use of of_clk_parent_fill helper function
  2015-06-11  9:06   ` Maxime Ripard
@ 2015-06-11 19:55     ` Dinh Nguyen
  0 siblings, 0 replies; 11+ messages in thread
From: Dinh Nguyen @ 2015-06-11 19:55 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: sboyd, mturquette, dinh.linux, linux-clk, linux-kernel,
	Emilio López

On 06/11/2015 04:06 AM, Maxime Ripard wrote:
> Hi Dinh,
> 
> On Wed, Jun 10, 2015 at 04:49:24PM -0500, dinguyen@opensource.altera.com wrote:
>> From: Dinh Nguyen <dinguyen@opensource.altera.com>
>>
>> Use of_clk_parent_fill to fill in the parent clock names' array.
>>
>> Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
>> Cc: Maxime Ripard <maxime.ripard@free-electrons.com>
>> Cc: "Emilio López" <emilio@elopez.com.ar>
>> ---
>>  drivers/clk/sunxi/clk-a20-gmac.c    |  3 +--
>>  drivers/clk/sunxi/clk-factors.c     |  4 +---
>>  drivers/clk/sunxi/clk-sun6i-ar100.c |  3 +--
>>  drivers/clk/sunxi/clk-sunxi.c       | 10 ++--------
>>  4 files changed, 5 insertions(+), 15 deletions(-)
>>
>> diff --git a/drivers/clk/sunxi/clk-a20-gmac.c b/drivers/clk/sunxi/clk-a20-gmac.c
>> index 0dcf4f2..a432edd 100644
>> --- a/drivers/clk/sunxi/clk-a20-gmac.c
>> +++ b/drivers/clk/sunxi/clk-a20-gmac.c
>> @@ -80,8 +80,7 @@ static void __init sun7i_a20_gmac_clk_setup(struct device_node *node)
>>  		goto free_mux;
>>  
>>  	/* gmac clock requires exactly 2 parents */
>> -	parents[0] = of_clk_get_parent_name(node, 0);
>> -	parents[1] = of_clk_get_parent_name(node, 1);
>> +	of_clk_parent_fill(node, parents, 2);
>>  	if (!parents[0] || !parents[1])
> 
> Maybe this check can be changed to something like:
> 
> if (of_clk_parent_fill(node, parents, 2) != 2)
>    goto free_gate;
> 
> Would that make sense?
> 

Yes, that would work. Will edit for v2.

Thanks,
Dinh


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-06-11 20:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-10 21:49 [PATCH 0/6] clk: make use of of_clk_parent_fill helper function dinguyen
2015-06-10 21:49 ` [PATCH 1/6] clk: at91: " dinguyen
2015-06-10 21:49 ` [PATCH 2/6] clk: qoriq: " dinguyen
2015-06-10 21:49 ` [PATCH 3/6] clk: keystone: " dinguyen
2015-06-10 22:14   ` santosh shilimkar
2015-06-10 21:49 ` [PATCH 4/6] clk: st: " dinguyen
2015-06-11  7:37   ` Gabriel Fernandez
2015-06-10 21:49 ` [PATCH 5/6] clk: sunxi: " dinguyen
2015-06-11  9:06   ` Maxime Ripard
2015-06-11 19:55     ` Dinh Nguyen
2015-06-10 21:49 ` [PATCH 6/6] clk: ti: " dinguyen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.