[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1456449952-27551-1-git-send-email-shawn.lin@rock-chips.com>
Date: Fri, 26 Feb 2016 09:25:52 +0800
From: Shawn Lin <shawn.lin@...k-chips.com>
To: Michael Turquette <mturquette@...libre.com>,
Stephen Boyd <sboyd@...eaurora.org>
Cc: linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org,
Shawn Lin <shawn.lin@...k-chips.com>
Subject: [PATCH] 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 drgrees is already
there, skip the following steps.
Signed-off-by: Shawn Lin <shawn.lin@...k-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
Powered by blists - more mailing lists