linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: skip unnecessary set_phase if nothing to do
@ 2016-02-26  1:25 Shawn Lin
  2016-02-26  2:11 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Shawn Lin @ 2016-02-26  1:25 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd; +Cc: linux-clk, linux-kernel, Shawn Lin

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] clk: skip unnecessary set_phase if nothing to do
  2016-02-26  1:25 [PATCH] clk: skip unnecessary set_phase if nothing to do Shawn Lin
@ 2016-02-26  2:11 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2016-02-26  2:11 UTC (permalink / raw)
  To: Shawn Lin; +Cc: Michael Turquette, linux-clk, linux-kernel

On 02/26, Shawn Lin wrote:
> 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>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-02-26  2:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-26  1:25 [PATCH] clk: skip unnecessary set_phase if nothing to do Shawn Lin
2016-02-26  2:11 ` Stephen Boyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).