Blame view

kernel/time/timekeeping_internal.h 827 Bytes
b24413180   Greg Kroah-Hartman   License cleanup: ...
1
  /* SPDX-License-Identifier: GPL-2.0 */
5c83545f2   Colin Cross   power: Add option...
2
3
4
5
6
  #ifndef _TIMEKEEPING_INTERNAL_H
  #define _TIMEKEEPING_INTERNAL_H
  /*
   * timekeeping debug functions
   */
3a9783778   Thomas Gleixner   clocksource: Make...
7
  #include <linux/clocksource.h>
5c83545f2   Colin Cross   power: Add option...
8
9
10
  #include <linux/time.h>
  
  #ifdef CONFIG_DEBUG_FS
7d489d15c   John Stultz   timekeeping: Conv...
11
  extern void tk_debug_account_sleep_time(struct timespec64 *t);
5c83545f2   Colin Cross   power: Add option...
12
13
14
  #else
  #define tk_debug_account_sleep_time(x)
  #endif
09ec54429   Thomas Gleixner   clocksource: Move...
15
  #ifdef CONFIG_CLOCKSOURCE_VALIDATE_LAST_CYCLE
a5a1d1c29   Thomas Gleixner   clocksource: Use ...
16
  static inline u64 clocksource_delta(u64 now, u64 last, u64 mask)
09ec54429   Thomas Gleixner   clocksource: Move...
17
  {
a5a1d1c29   Thomas Gleixner   clocksource: Use ...
18
  	u64 ret = (now - last) & mask;
09ec54429   Thomas Gleixner   clocksource: Move...
19

1f45f1f33   Yang Yingliang   clocksource: Make...
20
21
22
23
24
  	/*
  	 * Prevent time going backwards by checking the MSB of mask in
  	 * the result. If set, return 0.
  	 */
  	return ret & ~(mask >> 1) ? 0 : ret;
09ec54429   Thomas Gleixner   clocksource: Move...
25
26
  }
  #else
a5a1d1c29   Thomas Gleixner   clocksource: Use ...
27
  static inline u64 clocksource_delta(u64 now, u64 last, u64 mask)
3a9783778   Thomas Gleixner   clocksource: Make...
28
29
30
  {
  	return (now - last) & mask;
  }
09ec54429   Thomas Gleixner   clocksource: Move...
31
  #endif
3a9783778   Thomas Gleixner   clocksource: Make...
32

dee366541   DengChao   timekeeping: Prov...
33
  extern time64_t __ktime_get_real_seconds(void);
5c83545f2   Colin Cross   power: Add option...
34
  #endif /* _TIMEKEEPING_INTERNAL_H */