lkml.org 
[lkml]   [2016]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] clk: skip unnecessary set_phase if nothing to do
Date
Let's compare the degrees from clk_set_rate with
clk->core->phase. If the requested drgrees is already
there, skip the following steps.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

drivers/clk/clk.c | 5 +++++
1 file changed, 5 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index b4db67a..549fdb8 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -1902,6 +1902,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)
@@ -1912,6 +1916,7 @@ int clk_set_phase(struct clk *clk, int degrees)
if (!ret)
clk->core->phase = degrees;

+out:
clk_prepare_unlock();

return ret;
--
2.3.7

\
 
 \ /
  Last update: 2016-02-26 03:21    [W:0.114 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site