All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: optimize the divider walk in clk_divider_bestdiv()
@ 2016-01-05  3:43 Masahiro Yamada
  2016-01-30  0:45 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Masahiro Yamada @ 2016-01-05  3:43 UTC (permalink / raw)
  To: linux-clk; +Cc: Masahiro Yamada, Stephen Boyd, Michael Turquette, linux-kernel

Because _next_div() returns a valid divider, there is no need to
consult _is_valid_div() for the validity of the divider in every
iteration.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/clk/clk-divider.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c
index 358b9f9..8ced09e 100644
--- a/drivers/clk/clk-divider.c
+++ b/drivers/clk/clk-divider.c
@@ -304,9 +304,8 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,
 	 */
 	maxdiv = min(ULONG_MAX / rate, maxdiv);
 
-	for (i = 1; i <= maxdiv; i = _next_div(table, i, flags)) {
-		if (!_is_valid_div(table, i, flags))
-			continue;
+	for (i = _next_div(table, 0, flags); i <= maxdiv;
+					     i = _next_div(table, i, flags)) {
 		if (rate * i == parent_rate_saved) {
 			/*
 			 * It's the most ideal case if the requested rate can be
-- 
1.9.1


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

* Re: [PATCH] clk: optimize the divider walk in clk_divider_bestdiv()
  2016-01-05  3:43 [PATCH] clk: optimize the divider walk in clk_divider_bestdiv() Masahiro Yamada
@ 2016-01-30  0:45 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2016-01-30  0:45 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-clk, Michael Turquette, linux-kernel

On 01/05, Masahiro Yamada wrote:
> Because _next_div() returns a valid divider, there is no need to
> consult _is_valid_div() for the validity of the divider in every
> iteration.
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.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-01-30  0:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-05  3:43 [PATCH] clk: optimize the divider walk in clk_divider_bestdiv() Masahiro Yamada
2016-01-30  0:45 ` Stephen Boyd

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.