4 #include <linux/config.h>
5 #include <linux/list.h>
6 #include <linux/spinlock.h>
11 struct list_head entry;
12 unsigned long expires;
17 void (*function)(unsigned long);
20 struct tvec_t_base_s *base;
23 #define TIMER_MAGIC 0x4b87ad6e
25 #define TIMER_INITIALIZER(_function, _expires, _data) { \
26 .function = (_function), \
27 .expires = (_expires), \
30 .magic = TIMER_MAGIC, \
31 .lock = SPIN_LOCK_UNLOCKED, \
35 * init_timer - initialize a timer.
36 * @timer: the timer to be initialized
38 * init_timer() must be done to a timer prior calling *any* of the
39 * other timer functions.
41 static inline void init_timer(struct timer_list * timer)
44 timer->magic = TIMER_MAGIC;
45 spin_lock_init(&timer->lock);
49 * timer_pending - is a timer pending?
50 * @timer: the timer in question
52 * timer_pending will tell whether a given timer is currently pending,
53 * or not. Callers must ensure serialization wrt. other operations done
54 * to this timer, eg. interrupt contexts, or other CPUs on SMP.
56 * return value: 1 if the timer is pending, 0 if not.
58 static inline int timer_pending(const struct timer_list * timer)
60 return timer->base != NULL;
63 extern void add_timer_on(struct timer_list *timer, int cpu);
64 extern int del_timer(struct timer_list * timer);
65 extern int __mod_timer(struct timer_list *timer, unsigned long expires);
66 extern int mod_timer(struct timer_list *timer, unsigned long expires);
68 extern unsigned long next_timer_interrupt(void);
71 * add_timer - start a timer
72 * @timer: the timer to be added
74 * The kernel will do a ->function(->data) callback from the
75 * timer interrupt at the ->expired point in the future. The
76 * current time is 'jiffies'.
78 * The timer's ->expired, ->function (and if the handler uses it, ->data)
79 * fields must be set prior calling this function.
81 * Timers with an ->expired field in the past will be executed in the next
84 static inline void add_timer(struct timer_list * timer)
86 __mod_timer(timer, timer->expires);
90 extern int del_timer_sync(struct timer_list * timer);
92 # define del_timer_sync(t) del_timer(t)
95 extern void init_timers(void);
96 extern void run_local_timers(void);
97 extern void it_real_fn(unsigned long);