diff options
author | John Stultz <john.stultz@linaro.org> | 2011-08-10 14:08:07 -0400 |
---|---|---|
committer | John Stultz <john.stultz@linaro.org> | 2011-08-10 17:55:22 -0400 |
commit | 54da23b720d5d612f8f1669f9ed3744008fb7382 (patch) | |
tree | 52bfd90a34c4ad9de858ecb30d212104d0176845 /kernel | |
parent | 4b41308d2d0398409620613c7eaaaf52c738b042 (diff) |
alarmtimers: Push rearming peroidic timers down into alamrtimer handler
This patch pushes the periodic alarmtimer re-arming down into the alarmtimer
handler, mimicking how hrtimers handle this.
CC: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/time/alarmtimer.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index 9e786053ffa2..55e634ea6054 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c | |||
@@ -174,6 +174,7 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer) | |||
174 | unsigned long flags; | 174 | unsigned long flags; |
175 | ktime_t now; | 175 | ktime_t now; |
176 | int ret = HRTIMER_NORESTART; | 176 | int ret = HRTIMER_NORESTART; |
177 | int restart = ALARMTIMER_NORESTART; | ||
177 | 178 | ||
178 | spin_lock_irqsave(&base->lock, flags); | 179 | spin_lock_irqsave(&base->lock, flags); |
179 | now = base->gettime(); | 180 | now = base->gettime(); |
@@ -188,16 +189,16 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer) | |||
188 | 189 | ||
189 | timerqueue_del(&base->timerqueue, &alarm->node); | 190 | timerqueue_del(&base->timerqueue, &alarm->node); |
190 | alarm->enabled = 0; | 191 | alarm->enabled = 0; |
191 | /* Re-add periodic timers */ | 192 | |
192 | if (alarm->period.tv64) { | ||
193 | alarm->node.expires = ktime_add(expired, alarm->period); | ||
194 | timerqueue_add(&base->timerqueue, &alarm->node); | ||
195 | alarm->enabled = 1; | ||
196 | } | ||
197 | spin_unlock_irqrestore(&base->lock, flags); | 193 | spin_unlock_irqrestore(&base->lock, flags); |
198 | if (alarm->function) | 194 | if (alarm->function) |
199 | alarm->function(alarm, now); | 195 | restart = alarm->function(alarm, now); |
200 | spin_lock_irqsave(&base->lock, flags); | 196 | spin_lock_irqsave(&base->lock, flags); |
197 | |||
198 | if (restart != ALARMTIMER_NORESTART) { | ||
199 | timerqueue_add(&base->timerqueue, &alarm->node); | ||
200 | alarm->enabled = 1; | ||
201 | } | ||
201 | } | 202 | } |
202 | 203 | ||
203 | if (next) { | 204 | if (next) { |
@@ -373,6 +374,11 @@ static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm, | |||
373 | if (posix_timer_event(ptr, 0) != 0) | 374 | if (posix_timer_event(ptr, 0) != 0) |
374 | ptr->it_overrun++; | 375 | ptr->it_overrun++; |
375 | 376 | ||
377 | /* Re-add periodic timers */ | ||
378 | if (alarm->period.tv64) { | ||
379 | alarm->node.expires = ktime_add(now, alarm->period); | ||
380 | return ALARMTIMER_RESTART; | ||
381 | } | ||
376 | return ALARMTIMER_NORESTART; | 382 | return ALARMTIMER_NORESTART; |
377 | } | 383 | } |
378 | 384 | ||