summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDinh Nguyen <dinguyen@opensource.altera.com>2015-07-06 23:59:05 -0400
committerStephen Boyd <sboyd@codeaurora.org>2015-07-28 14:59:05 -0400
commit8a53fb2bceea00081c4a6af7b477bea8ec00b74b (patch)
treef9c472e04a9b3218105d7b29984f09d194428d0e
parent0b4e7f0842fe5c8bd19654999f6c41c4119e7c90 (diff)
clk: sunxi: make use of of_clk_parent_fill helper function
Use of_clk_parent_fill to fill in the parent clock names' array. Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: "Emilio López" <emilio@elopez.com.ar> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
-rw-r--r--drivers/clk/sunxi/clk-a20-gmac.c4
-rw-r--r--drivers/clk/sunxi/clk-factors.c4
-rw-r--r--drivers/clk/sunxi/clk-sun6i-ar100.c4
-rw-r--r--drivers/clk/sunxi/clk-sunxi.c14
4 files changed, 7 insertions, 19 deletions
diff --git a/drivers/clk/sunxi/clk-a20-gmac.c b/drivers/clk/sunxi/clk-a20-gmac.c
index 0dcf4f205fb8..1611b036421c 100644
--- a/drivers/clk/sunxi/clk-a20-gmac.c
+++ b/drivers/clk/sunxi/clk-a20-gmac.c
@@ -80,9 +80,7 @@ static void __init sun7i_a20_gmac_clk_setup(struct device_node *node)
80 goto free_mux; 80 goto free_mux;
81 81
82 /* gmac clock requires exactly 2 parents */ 82 /* gmac clock requires exactly 2 parents */
83 parents[0] = of_clk_get_parent_name(node, 0); 83 if (of_clk_parent_fill(node, parents, 2) != 2)
84 parents[1] = of_clk_get_parent_name(node, 1);
85 if (!parents[0] || !parents[1])
86 goto free_gate; 84 goto free_gate;
87 85
88 reg = of_iomap(node, 0); 86 reg = of_iomap(node, 0);
diff --git a/drivers/clk/sunxi/clk-factors.c b/drivers/clk/sunxi/clk-factors.c
index 94e2570a2409..a650eae4cc49 100644
--- a/drivers/clk/sunxi/clk-factors.c
+++ b/drivers/clk/sunxi/clk-factors.c
@@ -175,9 +175,7 @@ struct clk *sunxi_factors_register(struct device_node *node,
175 int i = 0; 175 int i = 0;
176 176
177 /* if we have a mux, we will have >1 parents */ 177 /* if we have a mux, we will have >1 parents */
178 while (i < FACTORS_MAX_PARENTS && 178 i = of_clk_parent_fill(node, parents, FACTORS_MAX_PARENTS);
179 (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
180 i++;
181 179
182 /* 180 /*
183 * some factor clocks, such as pll5 and pll6, may have multiple 181 * 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 21b076ee59d1..3a2ea010f148 100644
--- a/drivers/clk/sunxi/clk-sun6i-ar100.c
+++ b/drivers/clk/sunxi/clk-sun6i-ar100.c
@@ -182,7 +182,6 @@ static int sun6i_a31_ar100_clk_probe(struct platform_device *pdev)
182 struct resource *r; 182 struct resource *r;
183 struct clk *clk; 183 struct clk *clk;
184 int nparents; 184 int nparents;
185 int i;
186 185
187 ar100 = devm_kzalloc(&pdev->dev, sizeof(*ar100), GFP_KERNEL); 186 ar100 = devm_kzalloc(&pdev->dev, sizeof(*ar100), GFP_KERNEL);
188 if (!ar100) 187 if (!ar100)
@@ -197,8 +196,7 @@ static int sun6i_a31_ar100_clk_probe(struct platform_device *pdev)
197 if (nparents > SUN6I_AR100_MAX_PARENTS) 196 if (nparents > SUN6I_AR100_MAX_PARENTS)
198 nparents = SUN6I_AR100_MAX_PARENTS; 197 nparents = SUN6I_AR100_MAX_PARENTS;
199 198
200 for (i = 0; i < nparents; i++) 199 of_clk_parent_fill(np, parents, nparents);
201 parents[i] = of_clk_get_parent_name(np, i);
202 200
203 of_property_read_string(np, "clock-output-names", &clk_name); 201 of_property_read_string(np, "clock-output-names", &clk_name);
204 202
diff --git a/drivers/clk/sunxi/clk-sunxi.c b/drivers/clk/sunxi/clk-sunxi.c
index 0e15165280dc..2011f2178bd8 100644
--- a/drivers/clk/sunxi/clk-sunxi.c
+++ b/drivers/clk/sunxi/clk-sunxi.c
@@ -195,17 +195,14 @@ static void __init sun6i_ahb1_clk_setup(struct device_node *node)
195 const char *clk_name = node->name; 195 const char *clk_name = node->name;
196 const char *parents[SUN6I_AHB1_MAX_PARENTS]; 196 const char *parents[SUN6I_AHB1_MAX_PARENTS];
197 void __iomem *reg; 197 void __iomem *reg;
198 int i = 0; 198 int i;
199 199
200 reg = of_io_request_and_map(node, 0, of_node_full_name(node)); 200 reg = of_io_request_and_map(node, 0, of_node_full_name(node));
201 if (IS_ERR(reg)) 201 if (IS_ERR(reg))
202 return; 202 return;
203 203
204 /* we have a mux, we will have >1 parents */ 204 /* we have a mux, we will have >1 parents */
205 while (i < SUN6I_AHB1_MAX_PARENTS && 205 i = of_clk_parent_fill(node, parents, SUN6I_AHB1_MAX_PARENTS);
206 (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
207 i++;
208
209 of_property_read_string(node, "clock-output-names", &clk_name); 206 of_property_read_string(node, "clock-output-names", &clk_name);
210 207
211 ahb1 = kzalloc(sizeof(struct sun6i_ahb1_clk), GFP_KERNEL); 208 ahb1 = kzalloc(sizeof(struct sun6i_ahb1_clk), GFP_KERNEL);
@@ -786,14 +783,11 @@ static void __init sunxi_mux_clk_setup(struct device_node *node,
786 const char *clk_name = node->name; 783 const char *clk_name = node->name;
787 const char *parents[SUNXI_MAX_PARENTS]; 784 const char *parents[SUNXI_MAX_PARENTS];
788 void __iomem *reg; 785 void __iomem *reg;
789 int i = 0; 786 int i;
790 787
791 reg = of_iomap(node, 0); 788 reg = of_iomap(node, 0);
792 789
793 while (i < SUNXI_MAX_PARENTS && 790 i = of_clk_parent_fill(node, parents, SUNXI_MAX_PARENTS);
794 (parents[i] = of_clk_get_parent_name(node, i)) != NULL)
795 i++;
796
797 of_property_read_string(node, "clock-output-names", &clk_name); 791 of_property_read_string(node, "clock-output-names", &clk_name);
798 792
799 clk = clk_register_mux(NULL, clk_name, parents, i, 793 clk = clk_register_mux(NULL, clk_name, parents, i,