clk: at91: make use of of_clk_parent_fill helper function
authorDinh Nguyen <dinguyen@opensource.altera.com>
Tue, 7 Jul 2015 03:59:01 +0000 (22:59 -0500)
committerStephen Boyd <sboyd@codeaurora.org>
Tue, 28 Jul 2015 18:58:59 +0000 (11:58 -0700)
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>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/at91/clk-main.c
drivers/clk/at91/clk-master.c
drivers/clk/at91/clk-programmable.c
drivers/clk/at91/clk-slow.c
drivers/clk/at91/clk-smd.c
drivers/clk/at91/clk-usb.c

index 27dfa965cfedb020ebf66b635e0053ca58cefc1c..fd7247deabdc3de9cdf8ab0e4fb67d0c6775ef3e 100644 (file)
@@ -614,17 +614,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);
 
index 5b3ded5205a29177dde69509bd72032f7fff61aa..620ea323356b62145c4f7ef7f1d19511c5832015 100644 (file)
@@ -222,7 +222,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;
@@ -232,11 +231,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);
 
index 43dacad5c96d30cb53cc68aa0ed53163b26547bc..ce9c3b9d00f2e8ebeba0ac17104e654e2eb2769a 100644 (file)
@@ -231,7 +231,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];
@@ -242,11 +241,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))
index 98a84a865fe1cf1b13a437741631b83804e32bf6..84c19d7d29e80cb666477aea562cf6b5d0a353c3 100644 (file)
@@ -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);
 
index 3817ea865ca258ecb8675f6e35c39be4f53fd424..a7f8501cfa056222a103c1e0f05a442521f68eae 100644 (file)
@@ -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);
 
index 24747df97742967445d212e39e11dfcbeaae2a19..1fdf0e33545d3f599bc110777b1dff920a58d44e 100644 (file)
@@ -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);