[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-d653d8457c76da11f047af1f66256ac9b8421b69@git.kernel.org>
Date: Mon, 5 Jun 2017 01:24:34 -0700
From: tip-bot for Thomas Gleixner <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: tglx@...utronix.de, hpa@...or.com, peterz@...radead.org,
john.stultz@...aro.org, linux-kernel@...r.kernel.org,
mingo@...nel.org
Subject: [tip:timers/core] alarmtimer: Implement remaining callback
Commit-ID: d653d8457c76da11f047af1f66256ac9b8421b69
Gitweb: http://git.kernel.org/tip/d653d8457c76da11f047af1f66256ac9b8421b69
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Tue, 30 May 2017 23:15:56 +0200
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Sun, 4 Jun 2017 15:40:31 +0200
alarmtimer: Implement remaining callback
Preparatory change to utilize the common posix timer mechanisms.
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: John Stultz <john.stultz@...aro.org>
Link: http://lkml.kernel.org/r/20170530211657.592676753@linutronix.de
---
kernel/time/alarmtimer.c | 31 ++++++++++++++++++++++---------
1 file changed, 22 insertions(+), 9 deletions(-)
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 6082cf1..02ddc40 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -561,6 +561,18 @@ static int alarm_timer_forward(struct k_itimer *timr, ktime_t now)
}
/**
+ * alarm_timer_remaining - Posix timer callback to retrieve remaining time
+ * @timr: Pointer to the posixtimer data struct
+ * @now: Current time to calculate against
+ */
+static ktime_t alarm_timer_remaining(struct k_itimer *timr, ktime_t now)
+{
+ struct alarm *alarm = &timr->it.alarm.alarmtimer;
+
+ return ktime_sub(now, alarm->node.expires);
+}
+
+/**
* alarm_clock_getres - posix getres interface
* @which_clock: clockid
* @tp: timespec to fill
@@ -881,15 +893,16 @@ out:
}
const struct k_clock alarm_clock = {
- .clock_getres = alarm_clock_getres,
- .clock_get = alarm_clock_get,
- .timer_create = alarm_timer_create,
- .timer_set = alarm_timer_set,
- .timer_del = alarm_timer_del,
- .timer_get = alarm_timer_get,
- .timer_rearm = alarm_timer_rearm,
- .timer_forward = alarm_timer_forward,
- .nsleep = alarm_timer_nsleep,
+ .clock_getres = alarm_clock_getres,
+ .clock_get = alarm_clock_get,
+ .timer_create = alarm_timer_create,
+ .timer_set = alarm_timer_set,
+ .timer_del = alarm_timer_del,
+ .timer_get = alarm_timer_get,
+ .timer_rearm = alarm_timer_rearm,
+ .timer_forward = alarm_timer_forward,
+ .timer_remaining = alarm_timer_remaining,
+ .nsleep = alarm_timer_nsleep,
};
#endif /* CONFIG_POSIX_TIMERS */
Powered by blists - more mailing lists