提交 76369470 编写于 作者: A Arjan van de Ven

hrtimer: convert timerfd to the new hrtimer apis

In order to be able to do range hrtimers we need to use accessor functions
to the "expire" member of the hrtimer struct.
This patch converts timerfd to these accessors.
Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
上级 beb20d52
...@@ -52,11 +52,9 @@ static enum hrtimer_restart timerfd_tmrproc(struct hrtimer *htmr) ...@@ -52,11 +52,9 @@ static enum hrtimer_restart timerfd_tmrproc(struct hrtimer *htmr)
static ktime_t timerfd_get_remaining(struct timerfd_ctx *ctx) static ktime_t timerfd_get_remaining(struct timerfd_ctx *ctx)
{ {
ktime_t now, remaining; ktime_t remaining;
now = ctx->tmr.base->get_time();
remaining = ktime_sub(ctx->tmr.expires, now);
remaining = hrtimer_expires_remaining(&ctx->tmr);
return remaining.tv64 < 0 ? ktime_set(0, 0): remaining; return remaining.tv64 < 0 ? ktime_set(0, 0): remaining;
} }
...@@ -74,7 +72,7 @@ static void timerfd_setup(struct timerfd_ctx *ctx, int flags, ...@@ -74,7 +72,7 @@ static void timerfd_setup(struct timerfd_ctx *ctx, int flags,
ctx->ticks = 0; ctx->ticks = 0;
ctx->tintv = timespec_to_ktime(ktmr->it_interval); ctx->tintv = timespec_to_ktime(ktmr->it_interval);
hrtimer_init(&ctx->tmr, ctx->clockid, htmode); hrtimer_init(&ctx->tmr, ctx->clockid, htmode);
ctx->tmr.expires = texp; hrtimer_set_expires(&ctx->tmr, texp);
ctx->tmr.function = timerfd_tmrproc; ctx->tmr.function = timerfd_tmrproc;
if (texp.tv64 != 0) if (texp.tv64 != 0)
hrtimer_start(&ctx->tmr, texp, htmode); hrtimer_start(&ctx->tmr, texp, htmode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册