summaryrefslogtreecommitdiff
path: root/kernel/time/posix-timers.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2017-05-30 23:15:48 +0200
committerThomas Gleixner <tglx@linutronix.de>2017-06-04 15:40:26 +0200
commit21e55c1f83880a56360287c00f2b5cd5e5a4a912 (patch)
treea67f1d2979fc4b850cef4d950fe80cb414d8a77e /kernel/time/posix-timers.c
parentf37fb0aa4f453c7c785bbcecc4991ac48c5c0e51 (diff)
posix-timers: Add active flag to k_itimer
Keep track of the activation state of posix timers. This is a preparatory change for making common_timer_get() usable by both hrtimer and alarm timer implementations. 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/20170530211656.967783982@linutronix.de
Diffstat (limited to 'kernel/time/posix-timers.c')
-rw-r--r--kernel/time/posix-timers.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index b12582a4b122..795215bba73d 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -316,6 +316,7 @@ void posixtimer_rearm(struct siginfo *info)
if (timr->it_requeue_pending == info->si_sys_private) {
timr->kclock->timer_rearm(timr);
+ timr->it_active = 1;
timr->it_overrun_last = timr->it_overrun;
timr->it_overrun = -1;
++timr->it_requeue_pending;
@@ -371,6 +372,7 @@ static enum hrtimer_restart posix_timer_fn(struct hrtimer *timer)
timr = container_of(timer, struct k_itimer, it.real.timer);
spin_lock_irqsave(&timr->it_lock, flags);
+ timr->it_active = 0;
if (timr->it_interval != 0)
si_private = ++timr->it_requeue_pending;
@@ -418,6 +420,7 @@ static enum hrtimer_restart posix_timer_fn(struct hrtimer *timer)
timr->it_interval);
ret = HRTIMER_RESTART;
++timr->it_requeue_pending;
+ timr->it_active = 1;
}
}
@@ -737,7 +740,8 @@ common_timer_set(struct k_itimer *timr, int flags,
if (hrtimer_try_to_cancel(timer) < 0)
return TIMER_RETRY;
- timr->it_requeue_pending = (timr->it_requeue_pending + 2) &
+ timr->it_active = 0;
+ timr->it_requeue_pending = (timr->it_requeue_pending + 2) &
~REQUEUE_PENDING;
timr->it_overrun_last = 0;
@@ -763,6 +767,7 @@ common_timer_set(struct k_itimer *timr, int flags,
return 0;
}
+ timr->it_active = 1;
hrtimer_start_expires(timer, mode);
return 0;
}
@@ -821,6 +826,7 @@ static int common_timer_del(struct k_itimer *timer)
if (hrtimer_try_to_cancel(&timer->it.real.timer) < 0)
return TIMER_RETRY;
+ timer->it_active = 0;
return 0;
}