summaryrefslogtreecommitdiffstats
path: root/kernel/time/alarmtimer.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-05-30 23:15:54 +0200
committerThomas Gleixner <tglx@linutronix.de>2017-06-04 15:40:30 +0200
commitb3db80f77a95a45dbb2136f7b2a364dc797ea914 (patch)
treef679ba71ae5fcd6dc34d7f0a75b224fba7d0bc3e /kernel/time/alarmtimer.c
parentposix-timers: Make use of cancel/arm callbacks (diff)
downloadlinux-b3db80f77a95a45dbb2136f7b2a364dc797ea914.tar.xz
linux-b3db80f77a95a45dbb2136f7b2a364dc797ea914.zip
alarmtimer: Implement timer_rearm() 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.434598989@linutronix.de
Diffstat (limited to 'kernel/time/alarmtimer.c')
-rw-r--r--kernel/time/alarmtimer.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 5b8cf4b61854..be85e3cbfe1b 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -537,6 +537,18 @@ static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm,
}
/**
+ * alarm_timer_rearm - Posix timer callback for rearming timer
+ * @timr: Pointer to the posixtimer data struct
+ */
+static void alarm_timer_rearm(struct k_itimer *timr)
+{
+ struct alarm *alarm = &timr->it.alarm.alarmtimer;
+
+ timr->it_overrun += alarm_forward_now(alarm, timr->it_interval);
+ alarm_start(alarm, alarm->node.expires);
+}
+
+/**
* alarm_clock_getres - posix getres interface
* @which_clock: clockid
* @tp: timespec to fill
@@ -594,7 +606,7 @@ static int alarm_timer_create(struct k_itimer *new_timer)
/**
* alarm_timer_get - posix timer_get interface
- * @new_timer: k_itimer pointer
+ * @timr: k_itimer pointer
* @cur_setting: itimerspec data to fill
*
* Copies out the current itimerspec data
@@ -863,6 +875,7 @@ const struct k_clock alarm_clock = {
.timer_set = alarm_timer_set,
.timer_del = alarm_timer_del,
.timer_get = alarm_timer_get,
+ .timer_rearm = alarm_timer_rearm,
.nsleep = alarm_timer_nsleep,
};
#endif /* CONFIG_POSIX_TIMERS */