lkml.org 
[lkml]   [2017]   [Jun]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[tip:timers/core] alarmtimer: Implement forward callback
Commit-ID:  e7561f1633ac735df48c55ad09a2530e9ab9fab1
Gitweb: http://git.kernel.org/tip/e7561f1633ac735df48c55ad09a2530e9ab9fab1
Author: Thomas Gleixner <tglx@linutronix.de>
AuthorDate: Tue, 30 May 2017 23:15:55 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sun, 4 Jun 2017 15:40:30 +0200

alarmtimer: Implement forward callback

Preparatory change to utilize the common posix timer mechanisms.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: John Stultz <john.stultz@linaro.org>
Link: http://lkml.kernel.org/r/20170530211657.513694229@linutronix.de

---
kernel/time/alarmtimer.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index be85e3c..6082cf1 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -549,6 +549,18 @@ static void alarm_timer_rearm(struct k_itimer *timr)
}

/**
+ * alarm_timer_forward - Posix timer callback for forwarding timer
+ * @timr: Pointer to the posixtimer data struct
+ * @now: Current time to forward the timer against
+ */
+static int alarm_timer_forward(struct k_itimer *timr, ktime_t now)
+{
+ struct alarm *alarm = &timr->it.alarm.alarmtimer;
+
+ return (int) alarm_forward(alarm, timr->it_interval, now);
+}
+
+/**
* alarm_clock_getres - posix getres interface
* @which_clock: clockid
* @tp: timespec to fill
@@ -876,6 +888,7 @@ const struct k_clock alarm_clock = {
.timer_del = alarm_timer_del,
.timer_get = alarm_timer_get,
.timer_rearm = alarm_timer_rearm,
+ .timer_forward = alarm_timer_forward,
.nsleep = alarm_timer_nsleep,
};
#endif /* CONFIG_POSIX_TIMERS */
\
 
 \ /
  Last update: 2017-06-05 11:36    [W:0.219 / U:0.016 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site