clk: st: make use of of_clk_parent_fill helper function
authorDinh Nguyen <dinguyen@opensource.altera.com>
Tue, 7 Jul 2015 03:59:04 +0000 (22:59 -0500)
committerStephen Boyd <sboyd@codeaurora.org>
Tue, 28 Jul 2015 18:59:03 +0000 (11:59 -0700)
Use of_clk_parent_fill to fill in the parent clock names' array.

Signed-off-by: Dinh Nguyen <dinguyen@opensource.altera.com>
Tested-by Gabriel Fernandez <gabriel.fernandez@st.com>
Cc: Peter Griffin <peter.griffin@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/st/clk-flexgen.c
drivers/clk/st/clkgen-mux.c

index 8dd8cce273617e1db85c8af512a431cef14cf328..308dc2f265b1799ca11e73e2b8890a652bb65c43 100644 (file)
@@ -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;
 }
 
index ab9298395264c0172d1714fc07565c82c3adc670..de6c64f7839b0f73fd37428274307deb6c50121a 100644 (file)
@@ -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;
 }