summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorArjan van de Ven <arjan@linux.intel.com>2008-09-07 21:47:46 +0400
committerArjan van de Ven <arjan@linux.intel.com>2008-09-07 21:58:01 +0400
commitda8f2e170ea94cc20f8ebbc8ee8d127edb8f12f1 (patch)
tree08d25027a7769cd250aca5b516a3d8c95e4385be /include/linux
parent2ec02270c00f94b08fddfb68c37510a9fb47ac7c (diff)
downloadlinux-da8f2e170ea94cc20f8ebbc8ee8d127edb8f12f1.tar.xz
hrtimer: add a hrtimer_start_range() function
this patch adds a _range version of hrtimer_start() so that range timers can be created; the hrtimer_start() function is just a wrapper around this. In addition, hrtimer_start_expires() will now preserve existing ranges. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/hrtimer.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index 4c1a834b9849..1c0473e8ecb4 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -350,13 +350,20 @@ static inline void destroy_hrtimer_on_stack(struct hrtimer *timer) { }
/* Basic timer operations: */
extern int hrtimer_start(struct hrtimer *timer, ktime_t tim,
const enum hrtimer_mode mode);
+extern int hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
+ unsigned long range_ns, const enum hrtimer_mode mode);
extern int hrtimer_cancel(struct hrtimer *timer);
extern int hrtimer_try_to_cancel(struct hrtimer *timer);
static inline int hrtimer_start_expires(struct hrtimer *timer,
enum hrtimer_mode mode)
{
- return hrtimer_start(timer, hrtimer_get_expires(timer), mode);
+ unsigned long delta;
+ ktime_t soft, hard;
+ soft = hrtimer_get_softexpires(timer);
+ hard = hrtimer_get_expires(timer);
+ delta = ktime_to_ns(ktime_sub(hard, soft));
+ return hrtimer_start_range_ns(timer, hrtimer_get_expires(timer), delta, mode);
}
static inline int hrtimer_restart(struct hrtimer *timer)