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>
This commit is contained in:
Родитель
4b41308d2d
Коммит
54da23b720
|
@ -174,6 +174,7 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer)
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
ktime_t now;
|
ktime_t now;
|
||||||
int ret = HRTIMER_NORESTART;
|
int ret = HRTIMER_NORESTART;
|
||||||
|
int restart = ALARMTIMER_NORESTART;
|
||||||
|
|
||||||
spin_lock_irqsave(&base->lock, flags);
|
spin_lock_irqsave(&base->lock, flags);
|
||||||
now = base->gettime();
|
now = base->gettime();
|
||||||
|
@ -188,16 +189,16 @@ static enum hrtimer_restart alarmtimer_fired(struct hrtimer *timer)
|
||||||
|
|
||||||
timerqueue_del(&base->timerqueue, &alarm->node);
|
timerqueue_del(&base->timerqueue, &alarm->node);
|
||||||
alarm->enabled = 0;
|
alarm->enabled = 0;
|
||||||
/* Re-add periodic timers */
|
|
||||||
if (alarm->period.tv64) {
|
spin_unlock_irqrestore(&base->lock, flags);
|
||||||
alarm->node.expires = ktime_add(expired, alarm->period);
|
if (alarm->function)
|
||||||
|
restart = alarm->function(alarm, now);
|
||||||
|
spin_lock_irqsave(&base->lock, flags);
|
||||||
|
|
||||||
|
if (restart != ALARMTIMER_NORESTART) {
|
||||||
timerqueue_add(&base->timerqueue, &alarm->node);
|
timerqueue_add(&base->timerqueue, &alarm->node);
|
||||||
alarm->enabled = 1;
|
alarm->enabled = 1;
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&base->lock, flags);
|
|
||||||
if (alarm->function)
|
|
||||||
alarm->function(alarm, now);
|
|
||||||
spin_lock_irqsave(&base->lock, flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next) {
|
if (next) {
|
||||||
|
@ -373,6 +374,11 @@ static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm,
|
||||||
if (posix_timer_event(ptr, 0) != 0)
|
if (posix_timer_event(ptr, 0) != 0)
|
||||||
ptr->it_overrun++;
|
ptr->it_overrun++;
|
||||||
|
|
||||||
|
/* Re-add periodic timers */
|
||||||
|
if (alarm->period.tv64) {
|
||||||
|
alarm->node.expires = ktime_add(now, alarm->period);
|
||||||
|
return ALARMTIMER_RESTART;
|
||||||
|
}
|
||||||
return ALARMTIMER_NORESTART;
|
return ALARMTIMER_NORESTART;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче