diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/hrtimer.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index becd17db1a1a..9900e998ea8f 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
| @@ -217,6 +217,45 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer) | |||
| 217 | return timer->base->cpu_base->hres_active; | 217 | return timer->base->cpu_base->hres_active; |
| 218 | } | 218 | } |
| 219 | 219 | ||
| 220 | static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time) | ||
| 221 | { | ||
| 222 | timer->expires = time; | ||
| 223 | } | ||
| 224 | static inline void hrtimer_set_expires_tv64(struct hrtimer *timer, s64 tv64) | ||
| 225 | { | ||
| 226 | timer->expires.tv64 = tv64; | ||
| 227 | } | ||
| 228 | |||
| 229 | static inline void hrtimer_add_expires(struct hrtimer *timer, ktime_t time) | ||
| 230 | { | ||
| 231 | timer->expires = ktime_add_safe(timer->expires, time); | ||
| 232 | } | ||
| 233 | |||
| 234 | static inline void hrtimer_add_expires_ns(struct hrtimer *timer, unsigned long ns) | ||
| 235 | { | ||
| 236 | timer->expires = ktime_add_ns(timer->expires, ns); | ||
| 237 | } | ||
| 238 | |||
| 239 | static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer) | ||
| 240 | { | ||
| 241 | return timer->expires; | ||
| 242 | } | ||
| 243 | |||
| 244 | static inline s64 hrtimer_get_expires_tv64(const struct hrtimer *timer) | ||
| 245 | { | ||
| 246 | return timer->expires.tv64; | ||
| 247 | } | ||
| 248 | |||
| 249 | static inline s64 hrtimer_get_expires_ns(const struct hrtimer *timer) | ||
| 250 | { | ||
| 251 | return ktime_to_ns(timer->expires); | ||
| 252 | } | ||
| 253 | |||
| 254 | static inline ktime_t hrtimer_expires_remaining(const struct hrtimer *timer) | ||
| 255 | { | ||
| 256 | return ktime_sub(timer->expires, timer->base->get_time()); | ||
| 257 | } | ||
| 258 | |||
| 220 | /* | 259 | /* |
| 221 | * The resolution of the clocks. The resolution value is returned in | 260 | * The resolution of the clocks. The resolution value is returned in |
| 222 | * the clock_getres() system call to give application programmers an | 261 | * the clock_getres() system call to give application programmers an |
| @@ -287,6 +326,12 @@ extern int hrtimer_start(struct hrtimer *timer, ktime_t tim, | |||
| 287 | extern int hrtimer_cancel(struct hrtimer *timer); | 326 | extern int hrtimer_cancel(struct hrtimer *timer); |
| 288 | extern int hrtimer_try_to_cancel(struct hrtimer *timer); | 327 | extern int hrtimer_try_to_cancel(struct hrtimer *timer); |
| 289 | 328 | ||
| 329 | static inline int hrtimer_start_expires(struct hrtimer *timer, | ||
| 330 | enum hrtimer_mode mode) | ||
| 331 | { | ||
| 332 | return hrtimer_start(timer, hrtimer_get_expires(timer), mode); | ||
| 333 | } | ||
| 334 | |||
| 290 | static inline int hrtimer_restart(struct hrtimer *timer) | 335 | static inline int hrtimer_restart(struct hrtimer *timer) |
| 291 | { | 336 | { |
| 292 | return hrtimer_start(timer, timer->expires, HRTIMER_MODE_ABS); | 337 | return hrtimer_start(timer, timer->expires, HRTIMER_MODE_ABS); |
