linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clocksource/drivers/pistachio: Fix wrong calculated clocksource read value
@ 2015-11-25 15:42 Jisheng Zhang
  2015-12-15 20:59 ` Daniel Lezcano
  0 siblings, 1 reply; 14+ messages in thread
From: Jisheng Zhang @ 2015-11-25 15:42 UTC (permalink / raw)
  To: daniel.lezcano, tglx; +Cc: linux-kernel, linux-arm-kernel, Jisheng Zhang

Let's assume the counter value is 0xf000000, the pistachio clocksource
read cycles function would return 0xffffffff0fffffff, but it should
return 0xfffffff.

We fix this issue by calculating bitwise-not counter, then cast to
cycle_t.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
 drivers/clocksource/time-pistachio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clocksource/time-pistachio.c b/drivers/clocksource/time-pistachio.c
index bba6799..3269d9e 100644
--- a/drivers/clocksource/time-pistachio.c
+++ b/drivers/clocksource/time-pistachio.c
@@ -84,7 +84,7 @@ pistachio_clocksource_read_cycles(struct clocksource *cs)
 	counter = gpt_readl(pcs->base, TIMER_CURRENT_VALUE, 0);
 	raw_spin_unlock_irqrestore(&pcs->lock, flags);
 
-	return ~(cycle_t)counter;
+	return (cycle_t)~counter;
 }
 
 static u64 notrace pistachio_read_sched_clock(void)
-- 
2.6.2


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

end of thread, other threads:[~2015-12-17  9:11 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-25 15:42 [PATCH] clocksource/drivers/pistachio: Fix wrong calculated clocksource read value Jisheng Zhang
2015-12-15 20:59 ` Daniel Lezcano
2015-12-16  7:11   ` Jisheng Zhang
2015-12-16  7:28     ` Jisheng Zhang
2015-12-16  7:36       ` Jisheng Zhang
2015-12-16  7:49         ` Jisheng Zhang
2015-12-16  9:21         ` Daniel Lezcano
2015-12-16  9:33           ` Russell King - ARM Linux
2015-12-16 10:32             ` Daniel Lezcano
2015-12-16 10:38               ` Russell King - ARM Linux
2015-12-16 16:23                 ` Daniel Lezcano
2015-12-17  9:07                 ` Jisheng Zhang
2015-12-16  9:01       ` Daniel Lezcano
2015-12-16  9:02     ` Daniel Lezcano

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).