• Home
  • Raw
  • Download

Lines Matching refs:alarm

160 static void alarmtimer_enqueue(struct alarm_base *base, struct alarm *alarm)  in alarmtimer_enqueue()  argument
162 if (alarm->state & ALARMTIMER_STATE_ENQUEUED) in alarmtimer_enqueue()
163 timerqueue_del(&base->timerqueue, &alarm->node); in alarmtimer_enqueue()
165 timerqueue_add(&base->timerqueue, &alarm->node); in alarmtimer_enqueue()
166 alarm->state |= ALARMTIMER_STATE_ENQUEUED; in alarmtimer_enqueue()
178 static void alarmtimer_dequeue(struct alarm_base *base, struct alarm *alarm) in alarmtimer_dequeue() argument
180 if (!(alarm->state & ALARMTIMER_STATE_ENQUEUED)) in alarmtimer_dequeue()
183 timerqueue_del(&base->timerqueue, &alarm->node); in alarmtimer_dequeue()
184 alarm->state &= ~ALARMTIMER_STATE_ENQUEUED; in alarmtimer_dequeue()
199 struct alarm *alarm = container_of(timer, struct alarm, timer); in alarmtimer_fired() local
200 struct alarm_base *base = &alarm_bases[alarm->type]; in alarmtimer_fired()
206 alarmtimer_dequeue(base, alarm); in alarmtimer_fired()
209 if (alarm->function) in alarmtimer_fired()
210 restart = alarm->function(alarm, base->get_ktime()); in alarmtimer_fired()
214 hrtimer_set_expires(&alarm->timer, alarm->node.expires); in alarmtimer_fired()
215 alarmtimer_enqueue(base, alarm); in alarmtimer_fired()
220 trace_alarmtimer_fired(alarm, base->get_ktime()); in alarmtimer_fired()
225 ktime_t alarm_expires_remaining(const struct alarm *alarm) in alarm_expires_remaining() argument
227 struct alarm_base *base = &alarm_bases[alarm->type]; in alarm_expires_remaining()
228 return ktime_sub(alarm->node.expires, base->get_ktime()); in alarm_expires_remaining()
326 __alarm_init(struct alarm *alarm, enum alarmtimer_type type, in __alarm_init() argument
327 enum alarmtimer_restart (*function)(struct alarm *, ktime_t)) in __alarm_init() argument
329 timerqueue_init(&alarm->node); in __alarm_init()
330 alarm->timer.function = alarmtimer_fired; in __alarm_init()
331 alarm->function = function; in __alarm_init()
332 alarm->type = type; in __alarm_init()
333 alarm->state = ALARMTIMER_STATE_INACTIVE; in __alarm_init()
342 void alarm_init(struct alarm *alarm, enum alarmtimer_type type, in alarm_init() argument
343 enum alarmtimer_restart (*function)(struct alarm *, ktime_t)) in alarm_init() argument
345 hrtimer_init(&alarm->timer, alarm_bases[type].base_clockid, in alarm_init()
347 __alarm_init(alarm, type, function); in alarm_init()
356 void alarm_start(struct alarm *alarm, ktime_t start) in alarm_start() argument
358 struct alarm_base *base = &alarm_bases[alarm->type]; in alarm_start()
362 alarm->node.expires = start; in alarm_start()
363 alarmtimer_enqueue(base, alarm); in alarm_start()
364 hrtimer_start(&alarm->timer, alarm->node.expires, HRTIMER_MODE_ABS); in alarm_start()
367 trace_alarmtimer_start(alarm, base->get_ktime()); in alarm_start()
376 void alarm_start_relative(struct alarm *alarm, ktime_t start) in alarm_start_relative() argument
378 struct alarm_base *base = &alarm_bases[alarm->type]; in alarm_start_relative()
381 alarm_start(alarm, start); in alarm_start_relative()
385 void alarm_restart(struct alarm *alarm) in alarm_restart() argument
387 struct alarm_base *base = &alarm_bases[alarm->type]; in alarm_restart()
391 hrtimer_set_expires(&alarm->timer, alarm->node.expires); in alarm_restart()
392 hrtimer_restart(&alarm->timer); in alarm_restart()
393 alarmtimer_enqueue(base, alarm); in alarm_restart()
405 int alarm_try_to_cancel(struct alarm *alarm) in alarm_try_to_cancel() argument
407 struct alarm_base *base = &alarm_bases[alarm->type]; in alarm_try_to_cancel()
412 ret = hrtimer_try_to_cancel(&alarm->timer); in alarm_try_to_cancel()
414 alarmtimer_dequeue(base, alarm); in alarm_try_to_cancel()
417 trace_alarmtimer_cancel(alarm, base->get_ktime()); in alarm_try_to_cancel()
429 int alarm_cancel(struct alarm *alarm) in alarm_cancel() argument
432 int ret = alarm_try_to_cancel(alarm); in alarm_cancel()
435 hrtimer_cancel_wait_running(&alarm->timer); in alarm_cancel()
441 u64 alarm_forward(struct alarm *alarm, ktime_t now, ktime_t interval) in alarm_forward() argument
446 delta = ktime_sub(now, alarm->node.expires); in alarm_forward()
456 alarm->node.expires = ktime_add_ns(alarm->node.expires, in alarm_forward()
459 if (alarm->node.expires > now) in alarm_forward()
468 alarm->node.expires = ktime_add_safe(alarm->node.expires, interval); in alarm_forward()
473 static u64 __alarm_forward_now(struct alarm *alarm, ktime_t interval, bool throttle) in __alarm_forward_now() argument
475 struct alarm_base *base = &alarm_bases[alarm->type]; in __alarm_forward_now()
496 return alarm_forward(alarm, now, interval); in __alarm_forward_now()
499 u64 alarm_forward_now(struct alarm *alarm, ktime_t interval) in alarm_forward_now() argument
501 return __alarm_forward_now(alarm, interval, false); in alarm_forward_now()
560 static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm, in alarm_handle_timer() argument
563 struct k_itimer *ptr = container_of(alarm, struct k_itimer, in alarm_handle_timer()
564 it.alarm.alarmtimer); in alarm_handle_timer()
581 ptr->it_overrun += __alarm_forward_now(alarm, ptr->it_interval, true); in alarm_handle_timer()
597 struct alarm *alarm = &timr->it.alarm.alarmtimer; in alarm_timer_rearm() local
599 timr->it_overrun += alarm_forward_now(alarm, timr->it_interval); in alarm_timer_rearm()
600 alarm_start(alarm, alarm->node.expires); in alarm_timer_rearm()
610 struct alarm *alarm = &timr->it.alarm.alarmtimer; in alarm_timer_forward() local
612 return alarm_forward(alarm, timr->it_interval, now); in alarm_timer_forward()
622 struct alarm *alarm = &timr->it.alarm.alarmtimer; in alarm_timer_remaining() local
624 return ktime_sub(alarm->node.expires, now); in alarm_timer_remaining()
633 return alarm_try_to_cancel(&timr->it.alarm.alarmtimer); in alarm_timer_try_to_cancel()
646 hrtimer_cancel_wait_running(&timr->it.alarm.alarmtimer.timer); in alarm_timer_wait_running()
659 struct alarm *alarm = &timr->it.alarm.alarmtimer; in alarm_timer_arm() local
660 struct alarm_base *base = &alarm_bases[alarm->type]; in alarm_timer_arm()
665 alarm->node.expires = expires; in alarm_timer_arm()
667 alarm_start(&timr->it.alarm.alarmtimer, expires); in alarm_timer_arm()
739 alarm_init(&new_timer->it.alarm.alarmtimer, type, alarm_handle_timer); in alarm_timer_create()
752 static enum alarmtimer_restart alarmtimer_nsleep_wakeup(struct alarm *alarm, in alarmtimer_nsleep_wakeup() argument
755 struct task_struct *task = (struct task_struct *)alarm->data; in alarmtimer_nsleep_wakeup()
757 alarm->data = NULL; in alarmtimer_nsleep_wakeup()
771 static int alarmtimer_do_nsleep(struct alarm *alarm, ktime_t absexp, in alarmtimer_do_nsleep() argument
775 alarm->data = (void *)current; in alarmtimer_do_nsleep()
778 alarm_start(alarm, absexp); in alarmtimer_do_nsleep()
779 if (likely(alarm->data)) in alarmtimer_do_nsleep()
782 alarm_cancel(alarm); in alarmtimer_do_nsleep()
783 } while (alarm->data && !signal_pending(current)); in alarmtimer_do_nsleep()
787 destroy_hrtimer_on_stack(&alarm->timer); in alarmtimer_do_nsleep()
789 if (!alarm->data) in alarmtimer_do_nsleep()
811 alarm_init_on_stack(struct alarm *alarm, enum alarmtimer_type type, in alarm_init_on_stack() argument
812 enum alarmtimer_restart (*function)(struct alarm *, ktime_t)) in alarm_init_on_stack() argument
814 hrtimer_init_on_stack(&alarm->timer, alarm_bases[type].base_clockid, in alarm_init_on_stack()
816 __alarm_init(alarm, type, function); in alarm_init_on_stack()
829 struct alarm alarm; in alarm_timer_nsleep_restart() local
831 alarm_init_on_stack(&alarm, type, alarmtimer_nsleep_wakeup); in alarm_timer_nsleep_restart()
833 return alarmtimer_do_nsleep(&alarm, exp, type); in alarm_timer_nsleep_restart()
849 struct alarm alarm; in alarm_timer_nsleep() local
862 alarm_init_on_stack(&alarm, type, alarmtimer_nsleep_wakeup); in alarm_timer_nsleep()
874 ret = alarmtimer_do_nsleep(&alarm, exp, type); in alarm_timer_nsleep()