clocksource: Use a plain u64 instead of cycle_t
[linux-2.6-block.git] / kernel / time / timekeeping_internal.h
CommitLineData
5c83545f
CC
1#ifndef _TIMEKEEPING_INTERNAL_H
2#define _TIMEKEEPING_INTERNAL_H
3/*
4 * timekeeping debug functions
5 */
3a978377 6#include <linux/clocksource.h>
5c83545f
CC
7#include <linux/time.h>
8
9#ifdef CONFIG_DEBUG_FS
7d489d15 10extern void tk_debug_account_sleep_time(struct timespec64 *t);
5c83545f
CC
11#else
12#define tk_debug_account_sleep_time(x)
13#endif
14
09ec5442 15#ifdef CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE
a5a1d1c2 16static inline u64 clocksource_delta(u64 now, u64 last, u64 mask)
09ec5442 17{
a5a1d1c2 18 u64 ret = (now - last) & mask;
09ec5442 19
1f45f1f3
YY
20 /*
21 * Prevent time going backwards by checking the MSB of mask in
22 * the result. If set, return 0.
23 */
24 return ret & ~(mask >> 1) ? 0 : ret;
09ec5442
TG
25}
26#else
a5a1d1c2 27static inline u64 clocksource_delta(u64 now, u64 last, u64 mask)
3a978377
TG
28{
29 return (now - last) & mask;
30}
09ec5442 31#endif
3a978377 32
dee36654
D
33extern time64_t __ktime_get_real_seconds(void);
34
5c83545f 35#endif /* _TIMEKEEPING_INTERNAL_H */