[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-b3bf6f369d50ece9dec6338741648005d95c19e4@git.kernel.org>
Date: Mon, 5 Jun 2017 01:25:42 -0700
From: tip-bot for Thomas Gleixner <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: peterz@...radead.org, linux-kernel@...r.kernel.org,
john.stultz@...aro.org, tglx@...utronix.de, hpa@...or.com,
mingo@...nel.org
Subject: [tip:timers/core] alarmtimer: Implement arm callback
Commit-ID: b3bf6f369d50ece9dec6338741648005d95c19e4
Gitweb: http://git.kernel.org/tip/b3bf6f369d50ece9dec6338741648005d95c19e4
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Tue, 30 May 2017 23:15:58 +0200
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Sun, 4 Jun 2017 15:40:31 +0200
alarmtimer: Implement arm 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.747567162@linutronix.de
---
kernel/time/alarmtimer.c | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 374bd85..c618a44 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -582,6 +582,27 @@ static int alarm_timer_try_to_cancel(struct k_itimer *timr)
}
/**
+ * alarm_timer_arm - Posix timer callback to arm a timer
+ * @timr: Pointer to the posixtimer data struct
+ * @expires: The new expiry time
+ * @absolute: Expiry value is absolute time
+ * @sigev_none: Posix timer does not deliver signals
+ */
+static void alarm_timer_arm(struct k_itimer *timr, ktime_t expires,
+ bool absolute, bool sigev_none)
+{
+ struct alarm *alarm = &timr->it.alarm.alarmtimer;
+ struct alarm_base *base = &alarm_bases[alarm->type];
+
+ if (!absolute)
+ expires = ktime_add_safe(expires, base->gettime());
+ if (sigev_none)
+ alarm->node.expires = expires;
+ else
+ alarm_start(&timr->it.alarm.alarmtimer, expires);
+}
+
+/**
* alarm_clock_getres - posix getres interface
* @which_clock: clockid
* @tp: timespec to fill
@@ -908,6 +929,7 @@ const struct k_clock alarm_clock = {
.timer_set = alarm_timer_set,
.timer_del = alarm_timer_del,
.timer_get = alarm_timer_get,
+ .timer_arm = alarm_timer_arm,
.timer_rearm = alarm_timer_rearm,
.timer_forward = alarm_timer_forward,
.timer_remaining = alarm_timer_remaining,
Powered by blists - more mailing lists