linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: sunxi-ng: Fix inverted test condition in ccu_helper_wait_for_lock
@ 2016-07-14  2:42 Chen-Yu Tsai
  2016-07-15  8:06 ` Maxime Ripard
  0 siblings, 1 reply; 3+ messages in thread
From: Chen-Yu Tsai @ 2016-07-14  2:42 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Maxime Ripard
  Cc: Chen-Yu Tsai, linux-clk, linux-arm-kernel

The condition passed to read*_poll_timeout() is the break condition,
i.e. wait for this condition to happen and return success.

The original code assumed the opposite, resulting in a warning when
the PLL clock rate was changed but never lost it's lock as far as
the readout indicated. This was verified by checking the read out
register value.

Fixes: 1d80c14248d6 ("clk: sunxi-ng: Add common infrastructure")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/clk/sunxi-ng/ccu_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/sunxi-ng/ccu_common.c b/drivers/clk/sunxi-ng/ccu_common.c
index fc17b5295e16..51d4bac97ab3 100644
--- a/drivers/clk/sunxi-ng/ccu_common.c
+++ b/drivers/clk/sunxi-ng/ccu_common.c
@@ -31,7 +31,7 @@ void ccu_helper_wait_for_lock(struct ccu_common *common, u32 lock)
 		return;
 
 	WARN_ON(readl_relaxed_poll_timeout(common->base + common->reg, reg,
-					   !(reg & lock), 100, 70000));
+					   reg & lock, 100, 70000));
 }
 
 int sunxi_ccu_probe(struct device_node *node, void __iomem *reg,
-- 
2.8.1

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

* Re: [PATCH] clk: sunxi-ng: Fix inverted test condition in ccu_helper_wait_for_lock
  2016-07-14  2:42 [PATCH] clk: sunxi-ng: Fix inverted test condition in ccu_helper_wait_for_lock Chen-Yu Tsai
@ 2016-07-15  8:06 ` Maxime Ripard
  2016-08-10 22:06   ` Stephen Boyd
  0 siblings, 1 reply; 3+ messages in thread
From: Maxime Ripard @ 2016-07-15  8:06 UTC (permalink / raw)
  To: Chen-Yu Tsai; +Cc: Michael Turquette, Stephen Boyd, linux-clk, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 806 bytes --]

On Thu, Jul 14, 2016 at 10:42:35AM +0800, Chen-Yu Tsai wrote:
> The condition passed to read*_poll_timeout() is the break condition,
> i.e. wait for this condition to happen and return success.
> 
> The original code assumed the opposite, resulting in a warning when
> the PLL clock rate was changed but never lost it's lock as far as
> the readout indicated. This was verified by checking the read out
> register value.
> 
> Fixes: 1d80c14248d6 ("clk: sunxi-ng: Add common infrastructure")
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Mike, Stephen, could you add that patch on top of the current branch?

Thanks,
Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH] clk: sunxi-ng: Fix inverted test condition in ccu_helper_wait_for_lock
  2016-07-15  8:06 ` Maxime Ripard
@ 2016-08-10 22:06   ` Stephen Boyd
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2016-08-10 22:06 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, Michael Turquette, linux-clk, linux-arm-kernel

On 07/15, Maxime Ripard wrote:
> On Thu, Jul 14, 2016 at 10:42:35AM +0800, Chen-Yu Tsai wrote:
> > The condition passed to read*_poll_timeout() is the break condition,
> > i.e. wait for this condition to happen and return success.
> > 
> > The original code assumed the opposite, resulting in a warning when
> > the PLL clock rate was changed but never lost it's lock as far as
> > the readout indicated. This was verified by checking the read out
> > register value.
> > 
> > Fixes: 1d80c14248d6 ("clk: sunxi-ng: Add common infrastructure")
> > Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> 
> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
> 
> Mike, Stephen, could you add that patch on top of the current branch?
> 

Applied to clk-fixes

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

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

end of thread, other threads:[~2016-08-10 22:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-14  2:42 [PATCH] clk: sunxi-ng: Fix inverted test condition in ccu_helper_wait_for_lock Chen-Yu Tsai
2016-07-15  8:06 ` Maxime Ripard
2016-08-10 22:06   ` 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).