summaryrefslogtreecommitdiff
path: root/drivers/clk/clk.c
diff options
context:
space:
mode:
authorShawn Lin <shawn.lin@rock-chips.com>2016-02-26 09:25:52 +0800
committerStephen Boyd <sboyd@codeaurora.org>2016-02-25 18:10:51 -0800
commit023bd7166be0595d18220dfd5c9765b3970f6ef3 (patch)
tree0e4a273d8a1332e68ad7af4e8c30a22db6815fc6 /drivers/clk/clk.c
parent2103a2156119b30f5924af2a1094227954be4617 (diff)
clk: skip unnecessary set_phase if nothing to do
Let's compare the degrees from clk_set_rate with clk->core->phase. If the requested degrees is already there, skip the following steps. Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com> [sboyd@codeaurora.org: s/drgrees/degrees/ in commit text] Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
Diffstat (limited to 'drivers/clk/clk.c')
-rw-r--r--drivers/clk/clk.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index d95d6f924cac..437eebf89fcf 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1841,6 +1841,10 @@ int clk_set_phase(struct clk *clk, int degrees)
clk_prepare_lock();
+ /* bail early if nothing to do */
+ if (degrees == clk->core->phase)
+ goto out;
+
trace_clk_set_phase(clk->core, degrees);
if (clk->core->ops->set_phase)
@@ -1851,6 +1855,7 @@ int clk_set_phase(struct clk *clk, int degrees)
if (!ret)
clk->core->phase = degrees;
+out:
clk_prepare_unlock();
return ret;