clk: remove duplicated code with __clk_set_parent_after
authorDong Aisheng <aisheng.dong@freescale.com>
Tue, 28 Jul 2015 13:19:41 +0000 (21:19 +0800)
committerMichael Turquette <mturquette@baylibre.com>
Mon, 24 Aug 2015 23:49:13 +0000 (16:49 -0700)
__clk_set_parent_after() actually used the second argument then we
could put this duplicate logic in there and call it with a different
order of arguments in the success vs. error paths in this function.

Cc: Mike Turquette <mturquette@linaro.org>
Suggested-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Dong Aisheng <aisheng.dong@freescale.com>
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
drivers/clk/clk.c

index 8e6688d1ecbd007eeac3f7fba372d467e1f9c4eb..43e2c3ad6c3111ae6d0a83f027b75344c087f5f2 100644 (file)
@@ -1208,14 +1208,8 @@ static int __clk_set_parent(struct clk_core *core, struct clk_core *parent,
                flags = clk_enable_lock();
                clk_reparent(core, old_parent);
                clk_enable_unlock(flags);
+               __clk_set_parent_after(core, old_parent, parent);
 
-               if (core->prepare_count) {
-                       flags = clk_enable_lock();
-                       clk_core_disable(core);
-                       clk_core_disable(parent);
-                       clk_enable_unlock(flags);
-                       clk_core_unprepare(parent);
-               }
                return ret;
        }