From: Jisheng Zhang <jszhang@marvell.com>
To: <daniel.lezcano@linaro.org>, <tglx@linutronix.de>
Cc: <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
Jisheng Zhang <jszhang@marvell.com>
Subject: [PATCH] clocksource/drivers/pistachio: Fix wrong calculated clocksource read value
Date: Wed, 25 Nov 2015 23:42:49 +0800 [thread overview]
Message-ID: <1448466169-5230-1-git-send-email-jszhang@marvell.com> (raw)
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
next reply other threads:[~2015-11-25 15:47 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-25 15:42 Jisheng Zhang [this message]
2015-12-15 20:59 ` [PATCH] clocksource/drivers/pistachio: Fix wrong calculated clocksource read value 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1448466169-5230-1-git-send-email-jszhang@marvell.com \
--to=jszhang@marvell.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).