summaryrefslogtreecommitdiff
path: root/arch/s390/include/asm/timex.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2017-04-03 01:06:59 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2017-04-03 01:06:59 -0400
commita8e28440016bfb23bec266c4c66eacca6ea2d48b (patch)
tree27d528294f7886c434c8072a034d211acc06d077 /arch/s390/include/asm/timex.h
parent2b5efc089769cd2aa583880d29416d00e7441f39 (diff)
parent3209f68b3ca4667069923a325c88b21131bfdf9f (diff)
Merge branch 'work.statx' into for-next
Diffstat (limited to 'arch/s390/include/asm/timex.h')
-rw-r--r--arch/s390/include/asm/timex.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
index 354344dcc198..118535123f34 100644
--- a/arch/s390/include/asm/timex.h
+++ b/arch/s390/include/asm/timex.h
@@ -206,20 +206,16 @@ static inline unsigned long long get_tod_clock_monotonic(void)
* ns = (todval * 125) >> 9;
*
* In order to avoid an overflow with the multiplication we can rewrite this.
- * With a split todval == 2^32 * th + tl (th upper 32 bits, tl lower 32 bits)
+ * With a split todval == 2^9 * th + tl (th upper 55 bits, tl lower 9 bits)
* we end up with
*
- * ns = ((2^32 * th + tl) * 125 ) >> 9;
- * -> ns = (2^23 * th * 125) + ((tl * 125) >> 9);
+ * ns = ((2^9 * th + tl) * 125 ) >> 9;
+ * -> ns = (th * 125) + ((tl * 125) >> 9);
*
*/
static inline unsigned long long tod_to_ns(unsigned long long todval)
{
- unsigned long long ns;
-
- ns = ((todval >> 32) << 23) * 125;
- ns += ((todval & 0xffffffff) * 125) >> 9;
- return ns;
+ return ((todval >> 9) * 125) + (((todval & 0x1ff) * 125) >> 9);
}
#endif