aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm/timex.h
diff options
context:
space:
mode:
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)
206 * ns = (todval * 125) >> 9; 206 * ns = (todval * 125) >> 9;
207 * 207 *
208 * In order to avoid an overflow with the multiplication we can rewrite this. 208 * In order to avoid an overflow with the multiplication we can rewrite this.
209 * With a split todval == 2^32 * th + tl (th upper 32 bits, tl lower 32 bits) 209 * With a split todval == 2^9 * th + tl (th upper 55 bits, tl lower 9 bits)
210 * we end up with 210 * we end up with
211 * 211 *
212 * ns = ((2^32 * th + tl) * 125 ) >> 9; 212 * ns = ((2^9 * th + tl) * 125 ) >> 9;
213 * -> ns = (2^23 * th * 125) + ((tl * 125) >> 9); 213 * -> ns = (th * 125) + ((tl * 125) >> 9);
214 * 214 *
215 */ 215 */
216static inline unsigned long long tod_to_ns(unsigned long long todval) 216static inline unsigned long long tod_to_ns(unsigned long long todval)
217{ 217{
218 unsigned long long ns; 218 return ((todval >> 9) * 125) + (((todval & 0x1ff) * 125) >> 9);
219
220 ns = ((todval >> 32) << 23) * 125;
221 ns += ((todval & 0xffffffff) * 125) >> 9;
222 return ns;
223} 219}
224 220
225#endif 221#endif