diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index abb674c9b76465be8638acba950adcd90a21bea3..98c5c1537b5d7e1c94924401d1476a548324e752 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -85,7 +85,7 @@ struct hrtimer_base { spinlock_t lock; struct rb_root active; struct rb_node *first; - unsigned long resolution; + ktime_t resolution; ktime_t (*get_time)(void); struct hrtimer *curr_timer; }; diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 222a047cc145e8d25c8d68894c86bc390d2a929b..1bd6552cc34134c4e19d5565e992fc91b9785910 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h @@ -272,8 +272,8 @@ static inline u64 ktime_to_ns(const ktime_t kt) * idea of the (in)accuracy of timers. Timer values are rounded up to * this resolution values. */ -#define KTIME_REALTIME_RES (NSEC_PER_SEC/HZ) -#define KTIME_MONOTONIC_RES (NSEC_PER_SEC/HZ) +#define KTIME_REALTIME_RES (ktime_t){ .tv64 = TICK_NSEC } +#define KTIME_MONOTONIC_RES (ktime_t){ .tv64 = TICK_NSEC } /* Get the monotonic time in timespec format: */ extern void ktime_get_ts(struct timespec *ts); diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index e6e8278bcb18173f137b08d8602b7eb183b9d558..76d759ce62316e0a0ac8b69a02b4c753f9bec20f 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -518,9 +518,8 @@ int hrtimer_get_res(const clockid_t which_clock, struct timespec *tp) { struct hrtimer_base *bases; - tp->tv_sec = 0; bases = per_cpu(hrtimer_bases, raw_smp_processor_id()); - tp->tv_nsec = bases[which_clock].resolution; + *tp = ktime_to_timespec(bases[which_clock].resolution); return 0; }