Exemple #1
0
/**
 * __run_timers - run all expired timers (if any) on this CPU.
 * @base: the timer vector to be processed.
 *
 * This function executes all expired timer vectors.
 */
static inline void __run_timers(struct tti_tvec_base *base, unsigned long internal_tti)
{
	struct tti_timer_list *timer;

	while (time_after_eq(internal_tti, base->timer_jiffies)) {
		struct list_head work_list;
		struct list_head *head = &work_list;
		int index = base->timer_jiffies & TVR_MASK;

		++base->timer_jiffies;
		list_replace_init(base->tv.vec + index, &work_list);
		while (!list_empty(head)) {
			void (*fn)(unsigned long);
			unsigned long data;

			timer = list_first_entry(head, struct tti_timer_list, entry);
			fn = timer->function;
			data = timer->data;

            base->running_timer = timer;
			detach_timer(timer, 1);

			call_timer_fn(timer, fn, data);
		}
	}
	base->running_timer = NULL;
}
Exemple #2
0
static inline int
__tti_mod_timer(struct tti_timer_list *timer, unsigned long expires, bool pending_only)
{
	struct tti_tvec_base *base = _tti_tvec_base;
	int ret = 0;

	BUG_ON(!timer->function);

    if (tti_timer_pending(timer)) {
		detach_timer(timer, 0);
		if (timer->expires == base->next_timer)
			base->next_timer = base->timer_jiffies;
		ret = 1;
	} else {
		if (pending_only)
			goto out;
	}

    debug_activate(timer, expires);

    timer->expires = expires;
	if (time_before(timer->expires, base->next_timer))
		base->next_timer = timer->expires;
	tti_internal_add_timer(base, timer);

out:
    return ret;
}
Exemple #3
0
int del_timer(struct timer_list *timer)
{
    int ret;
    flag_t flags;

    save_flags(flags);
    clr_irq();
    ret = detach_timer(timer);
    restore_flags(flags);
    return ret;
}
Exemple #4
0
static void run_timer_list(void)
{
    register struct timer_list *timer;

    clr_irq();
    while ((timer = tl_list.tl_next) && timer->tl_expires <= jiffies) {
        detach_timer(timer);
        set_irq();
        timer->tl_function(timer->tl_data);
        clr_irq();
    }
    set_irq();
}
Exemple #5
0
static int detach_if_pending(struct timer_list *timer, struct tvec_base *base,
							 bool clear_pending)
{
	if (!timer_pending(timer))
		return 0;
	
	detach_timer(timer, clear_pending);
	if (!tbase_get_deferrable(timer->base)) {
		base->active_timers--;
		if (timer->expires == base->next_timer)
			base->next_timer = base->timer_jiffies;
	}
	return 1;
}
Exemple #6
0
/**
 * tti_del_timer - deactive a timer.
 * @timer: the timer to be deactivated
 *
 * tti_del_timer() deactivates a timer - this works on both active and inactive
 * timers.
 *
 * The function returns whether it has deactivated a pending timer or not.
 * (ie. tti_del_timer() of an inactive timer returns 0, tti_del_timer() of an
 * active timer returns 1.)
 */
int tti_del_timer(struct tti_timer_list *timer)
{
	struct tti_tvec_base *base = _tti_tvec_base;
	int ret = 0;

	if (tti_timer_pending(timer)) {
        detach_timer(timer, 1);
        if (timer->expires == base->next_timer)
            base->next_timer = base->timer_jiffies;
        ret = 1;
    }

	return ret;
}
Exemple #7
0
static inline void detach_expired_timer(struct timer_list *timer, struct tvec_base *base)
{
	detach_timer(timer, true);
	if (!tbase_get_deferrable(timer->base))
		base->active_timers--;
}