summaryrefslogtreecommitdiff
path: root/kernel/time
diff options
context:
space:
mode:
authorTodd Poynor <toddpoynor@google.com>2013-05-08 15:49:18 -0700
committerArve Hjønnevåg <arve@android.com>2013-07-01 14:16:28 -0700
commit0ccfc3ce82fbc2b2df5ab11ebfa43f894a6a4ae7 (patch)
tree5dad7a03303219500a2c5d42a177fb30ce6986ab /kernel/time
parent3ab74abdc30faaaa49eae6ae233769b092ec3378 (diff)
alarmtimer: add alarm_restart
Analogous to hrtimer_restart, restart an alarmtimer after the expires time has already been updated (as with alarm_forward). Change-Id: Ia2613bbb467404cb2c35c11efa772bc56294963a Signed-off-by: Todd Poynor <toddpoynor@google.com>
Diffstat (limited to 'kernel/time')
-rw-r--r--kernel/time/alarmtimer.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index f11d83b12949..059e78b12676 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -324,6 +324,18 @@ int alarm_start(struct alarm *alarm, ktime_t start)
return ret;
}
+void alarm_restart(struct alarm *alarm)
+{
+ struct alarm_base *base = &alarm_bases[alarm->type];
+ unsigned long flags;
+
+ spin_lock_irqsave(&base->lock, flags);
+ hrtimer_set_expires(&alarm->timer, alarm->node.expires);
+ hrtimer_restart(&alarm->timer);
+ alarmtimer_enqueue(base, alarm);
+ spin_unlock_irqrestore(&base->lock, flags);
+}
+
/**
* alarm_try_to_cancel - Tries to cancel an alarm timer
* @alarm: ptr to alarm to be canceled