Skip to contentSkip to conversation

clk: make use of of_clk_parent_fill helper function

PATCH Superseded [email protected] 4 participants 11 messages Jun 10, 2015 – Jun 11, 2015

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover clk: make use of of_clk_parent_fill helper function

From: Dinh Nguyen <[email protected]>

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 <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: "Emilio López" <[email protected]>
Cc: Peter Griffin <[email protected]>
Cc: Gabriel FERNANDEZ <[email protected]>
Cc: Santosh Shilimkar <[email protected]>
Cc: Boris Brezillon <[email protected]>

Signature · 1 line
2.2.1
#1 lore raw

PATCH 1/6 clk: at91: make use of of_clk_parent_fill helper function

From: Dinh Nguyen <[email protected]>

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

Cc Boris Brezillon <[email protected]>
---
 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(-)
drivers/clk/at91/clk-main.c +1 -6
index c240045..13f481b 100644
@@ -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);
 
drivers/clk/at91/clk-master.c +1 -6
index f98eafe..38f646d 100644
@@ -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);
 
drivers/clk/at91/clk-programmable.c +1 -6
index 8c86c0f..21492ac 100644
@@ -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))
drivers/clk/at91/clk-slow.c +2 -12
index 98a84a8..84c19d7 100644
@@ -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);
 
drivers/clk/at91/clk-smd.c +1 -6
index 3817ea8..a7f8501 100644
@@ -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);
 
drivers/clk/at91/clk-usb.c +1 -6
index b0cbd2b..b3cbf45 100644
@@ -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);
 
Signature · 1 line
2.2.1
#2 lore raw

PATCH 2/6 clk: qoriq: make use of of_clk_parent_fill helper function

In reply to [email protected]

From: Dinh Nguyen <[email protected]>

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

---
 drivers/clk/clk-qoriq.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/clk/clk-qoriq.c +2 -3
index cda90a9..d3f4570 100644
@@ -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)
Signature · 1 line
2.2.1
#3 lore raw

PATCH 3/6 clk: keystone: make use of of_clk_parent_fill helper function

In reply to [email protected]

From: Dinh Nguyen <[email protected]>

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

Cc Santosh Shilimkar <[email protected]>
---
 drivers/clk/keystone/pll.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/clk/keystone/pll.c +1 -2
index 0dd8a4b..d885372 100644
@@ -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;
Signature · 1 line
2.2.1
Acked-by on v1 3/6
#4 lore raw

Re: [PATCH 3/6] clk: keystone: make use of of_clk_parent_fill helper function

Quoted 10 lines · On 6/10/2015 2:49 PM, [email protected] wrote:

From: Dinh Nguyen <[email protected]>

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

Cc Santosh Shilimkar <[email protected]>
---
  drivers/clk/keystone/pll.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)

Looks fine by me.

Quoted 15 lines
drivers/clk/keystone/pll.c +1 -2
index 0dd8a4b..d885372 100644
@@ -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;
#5 lore raw

PATCH 4/6 clk: st: make use of of_clk_parent_fill helper function

In reply to [email protected]

From: Dinh Nguyen <[email protected]>

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

Cc Peter Griffin <[email protected]>
Cc Gabriel FERNANDEZ <[email protected]>
---
 drivers/clk/st/clk-flexgen.c | 6 ++----
 drivers/clk/st/clkgen-mux.c  | 7 ++-----
 2 files changed, 4 insertions(+), 9 deletions(-)
drivers/clk/st/clk-flexgen.c +2 -4
index 657ca14..ed0696c 100644
@@ -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;
 }
 
drivers/clk/st/clkgen-mux.c +2 -5
index 4fbe6e0..b83654a 100644
@@ -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;
 }
 
Signature · 1 line
2.2.1
#6 lore raw

Re: [PATCH 4/6] clk: st: make use of of_clk_parent_fill helper function

Hi

Tested-by Gabriel Fernandez <[email protected]>

Best Regards.

Quoted 62 lines · On 06/10/2015 11:49 PM, [email protected] wrote:

From: Dinh Nguyen <[email protected]>

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

Cc Peter Griffin <[email protected]>
Cc Gabriel FERNANDEZ <[email protected]>
---
  drivers/clk/st/clk-flexgen.c | 6 ++----
  drivers/clk/st/clkgen-mux.c  | 7 ++-----
  2 files changed, 4 insertions(+), 9 deletions(-)
drivers/clk/st/clk-flexgen.c +2 -4
index 657ca14..ed0696c 100644
@@ -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;
  }
 
drivers/clk/st/clkgen-mux.c +2 -5
index 4fbe6e0..b83654a 100644
@@ -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;
  }
 
#7 lore raw

PATCH 5/6 clk: sunxi: make use of of_clk_parent_fill helper function

In reply to [email protected]

From: Dinh Nguyen <[email protected]>

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

Cc Maxime Ripard <[email protected]>
Cc "Emilio López" <[email protected]>
---
 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(-)
drivers/clk/sunxi/clk-a20-gmac.c +1 -2
index 0dcf4f2..a432edd 100644
@@ -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;
 
drivers/clk/sunxi/clk-factors.c +1 -3
index 8c20190..2589457 100644
@@ -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
drivers/clk/sunxi/clk-sun6i-ar100.c +1 -2
index 63cf149..6f229ff 100644
@@ -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);
 
drivers/clk/sunxi/clk-sunxi.c +2 -8
index 7e1e2bd..ebea294 100644
@@ -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,
Signature · 1 line
2.2.1
#8 lore raw

Re: [PATCH 5/6] clk: sunxi: make use of of_clk_parent_fill helper function

Hi Dinh,

Quoted 19 lines · On Wed, Jun 10, 2015 at 04:49:24PM -0500, [email protected] wrote:

From: Dinh Nguyen <[email protected]>

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

Cc Maxime Ripard <[email protected]>
Cc "Emilio López" <[email protected]>
---
 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(-)
drivers/clk/sunxi/clk-a20-gmac.c +0 -0
index 0dcf4f2..a432edd 100644

drivers/clk/sunxi/clk-a20-gmac.c static void __init sun7i_a20_gmac_clk_setup(struct device_node *node) · line 84

Quoted 7 lines
drivers/clk/sunxi/clk-a20-gmac.c +1 -2
@@ -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

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#9 lore raw

Re: [PATCH 5/6] clk: sunxi: make use of of_clk_parent_fill helper function

Quoted 32 lines · Maxime Ripard

Hi Dinh,

Quoted 19 lines · On Wed, Jun 10, 2015 at 04:49:24PM -0500, [email protected] wrote:

From: Dinh Nguyen <[email protected]>

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

Cc Maxime Ripard <[email protected]>
Cc "Emilio López" <[email protected]>
---
 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(-)
drivers/clk/sunxi/clk-a20-gmac.c +0 -0
index 0dcf4f2..a432edd 100644

drivers/clk/sunxi/clk-a20-gmac.c static void __init sun7i_a20_gmac_clk_setup(struct device_node *node) · line 84

Quoted 7 lines
drivers/clk/sunxi/clk-a20-gmac.c +1 -2
@@ -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:

Quoted 5 lines

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

#10 lore raw

PATCH 6/6 clk: ti: make use of of_clk_parent_fill helper function

In reply to [email protected]

From: Dinh Nguyen <[email protected]>

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

---
 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(-)
drivers/clk/ti/apll.c +1 -3
index 49baf38..523880e 100644
@@ -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;
 
drivers/clk/ti/composite.c +1 -3
index 96f83ce..dbef218 100644
@@ -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) {
drivers/clk/ti/dpll.c +1 -3
index 2aacf7a..49acdf2 100644
@@ -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;
 
drivers/clk/ti/fapll.c +1 -2
index 730aa62..b1c741b 100644
@@ -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);
drivers/clk/ti/mux.c +1 -3
index 5cdeed5..99fe27e 100644
@@ -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);
 
Signature · 1 line
2.2.1