]> git.karo-electronics.de Git - linux-beck.git/commitdiff
clk: simplify clk_fetch_parent_index() function
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Mon, 28 Dec 2015 10:23:09 +0000 (19:23 +0900)
committerStephen Boyd <sboyd@codeaurora.org>
Tue, 2 Feb 2016 19:53:16 +0000 (11:53 -0800)
The clk_core_get_parent_by_index can be used as a helper function
to simplify the implementation of clk_fetch_parent_index().

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Vladimir Zapolskiy <vz@mleia.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/clk.c

index da7c9a523f02efd4d5dd26c5771ff178eab7969d..82b79a6ec0ec2beef64b16d9b8f3e7af1d09af3a 100644 (file)
@@ -1069,23 +1069,9 @@ static int clk_fetch_parent_index(struct clk_core *core,
        if (!parent)
                return -EINVAL;
 
-       /*
-        * find index of new parent clock using cached parent ptrs,
-        * or if not yet cached, use string name comparison and cache
-        * them now to avoid future calls to clk_core_lookup.
-        */
-       for (i = 0; i < core->num_parents; i++) {
-               if (core->parents[i] == parent)
-                       return i;
-
-               if (core->parents[i])
-                       continue;
-
-               if (!strcmp(core->parent_names[i], parent->name)) {
-                       core->parents[i] = clk_core_lookup(parent->name);
+       for (i = 0; i < core->num_parents; i++)
+               if (clk_core_get_parent_by_index(core, i) == parent)
                        return i;
-               }
-       }
 
        return -EINVAL;
 }