Use generic timeofday interfaces in hrtimer / ktime
When CONFIG_GENERIC_TIME is enabled use the ktime_t based interfaces of timeofday. Also disable the timespec based interfaces in hrtimers and use the timeofday interfaces directly.
Signed-off-by Thomas Gleixner <[email protected]>
include/linux/hrtimer.h | 1 + include/linux/ktime.h | 11 +++++++++++ kernel/hrtimer.c | 47 ++++++++++++++++++++++++----------------------- 3 files changed, 36 insertions(+), 23 deletions(-)
include/linux/hrtimer.h +1 -0
@@ -20,6 +20,7 @@#include <linux/init.h> #include <linux/list.h> #include <linux/wait.h> +#include <linux/timeofday.h> /* * Mode arguments of xxx_hrtimer functions:
include/linux/ktime.h +11 -0
@@ -275,10 +275,21 @@ static inline u64 ktime_to_ns(const ktim#define KTIME_REALTIME_RES (NSEC_PER_SEC/HZ)#define KTIME_MONOTONIC_RES (NSEC_PER_SEC/HZ) +#ifdef CONFIG_GENERIC_TIME + +#define ktime_get get_monotonic_clock +#define ktime_get_real get_realtime_clock +#define ktime_get_ts (ts) get_monotonic_clock_ts(ts) +#define ktime_get_real_ts (ts) get_realtime_clock_ts(ts) + +#else /* CONFIG_GENERIC_TIME */ +/* Get the monotonic time in timespec format: */ extern void ktime_get_ts (struct timespec *ts);/* Get the real (wall-) time in timespec format: */ #define ktime_get_real_ts (ts) getnstimeofday(ts) +#endif /* !CONFIG_GENERIC_TIME */ +#endif
kernel/hrtimer.c +24 -22
71 lines not on this page · raw message
kernel/time/timeofday.c +2 -0
@@ -238,6 +238,8 @@ ktime_t get_realtime_clock(void)return ret; } +EXPORT_SYMBOL_GPL (get_realtime_clock); +/** * get_realtime_offset - Returns the offset of realtime clock *