[PATCH 3/13] hrtimer: convert timerfd to the new hrtimer apis

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Arjan van de Ven
Date: Monday, September 1, 2008 - 4:06 pm

From: Arjan van de Ven <arjan@linux.intel.com>
Subject: [PATCH] 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: Arjan van de Ven <arjan@linux.intel.com>
---
 fs/timerfd.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/fs/timerfd.c b/fs/timerfd.c
index c502c60..0862f0e 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -52,11 +52,9 @@ static enum hrtimer_restart timerfd_tmrproc(struct hrtimer *htmr)
 
 static ktime_t timerfd_get_remaining(struct timerfd_ctx *ctx)
 {
-	ktime_t now, remaining;
-
-	now = ctx->tmr.base->get_time();
-	remaining = ktime_sub(ctx->tmr.expires, now);
+	ktime_t remaining;
 
+	remaining = hrtimer_expires_remaining(&ctx->tmr);
 	return remaining.tv64 < 0 ? ktime_set(0, 0): remaining;
 }
 
@@ -74,7 +72,7 @@ static void timerfd_setup(struct timerfd_ctx *ctx, int flags,
 	ctx->ticks = 0;
 	ctx->tintv = timespec_to_ktime(ktmr->it_interval);
 	hrtimer_init(&ctx->tmr, ctx->clockid, htmode);
-	ctx->tmr.expires = texp;
+	hrtimer_set_expires(&ctx->tmr, texp);
 	ctx->tmr.function = timerfd_tmrproc;
 	if (texp.tv64 != 0)
 		hrtimer_start(&ctx->tmr, texp, htmode);
-- 
1.5.5.1

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 0/13] Turn hrtimers into a range capable timer, Arjan van de Ven, (Mon Sep 1, 4:03 pm)
[PATCH 2/13] hrtimer: convert kvm to the new hrtimer apis, Arjan van de Ven, (Mon Sep 1, 4:05 pm)
[PATCH 3/13] hrtimer: convert timerfd to the new hrtimer apis, Arjan van de Ven, (Mon Sep 1, 4:06 pm)
[PATCH 8/13] hrtimer: convert s390 to the new hrtimer apis, Arjan van de Ven, (Mon Sep 1, 4:10 pm)
[PATCH 9/13] hrtimer: convert sound/ to the new hrtimer apis, Arjan van de Ven, (Mon Sep 1, 4:11 pm)
[PATCH 11/13] hrtimer: turn hrtimers into range timers, Arjan van de Ven, (Mon Sep 1, 4:13 pm)
Re: [PATCH 11/13] hrtimer: turn hrtimers into range timers, Arjan van de Ven, (Tue Sep 2, 6:05 am)
Re: [PATCH 11/13] hrtimer: turn hrtimers into range timers, Arjan van de Ven, (Tue Sep 2, 6:06 am)
Re: [PATCH 11/13] hrtimer: turn hrtimers into range timers, Arjan van de Ven, (Tue Sep 2, 9:02 am)
Re: [PATCH 0/13] Turn hrtimers into a range capable timer, Arjan van de Ven, (Sat Sep 6, 9:30 am)
Re: [PATCH 0/13] Turn hrtimers into a range capable timer, Rusty Russell, (Thu Sep 11, 8:39 pm)
Re: [PATCH 0/13] Turn hrtimers into a range capable timer, Arjan van de Ven, (Thu Sep 11, 10:42 pm)
Re: [PATCH 0/13] Turn hrtimers into a range capable timer, Thomas Gleixner, (Fri Sep 12, 1:24 pm)