X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Flinux%2Fhrtimer.h;fp=include%2Flinux%2Fhrtimer.h;h=6401c31d6add4e2025a4ca7bf72d7290ed4b34c1;hb=64ba3f394c830ec48a1c31b53dcae312c56f1604;hp=4fc379de6c2ffceea015fa9b80ba987cfc42742e;hpb=be1e6109ac94a859551f8e1774eb9a8469fe055c;p=linux-2.6.git diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 4fc379de6..6401c31d6 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -34,17 +34,28 @@ enum hrtimer_restart { HRTIMER_RESTART, }; -#define HRTIMER_INACTIVE ((void *)1UL) +/* + * Timer states: + */ +enum hrtimer_state { + HRTIMER_INACTIVE, /* Timer is inactive */ + HRTIMER_EXPIRED, /* Timer is expired */ + HRTIMER_RUNNING, /* Timer is running the callback function */ + HRTIMER_PENDING, /* Timer is pending */ +}; struct hrtimer_base; /** * struct hrtimer - the basic hrtimer structure + * * @node: red black tree node for time ordered insertion * @expires: the absolute expiry time in the hrtimers internal * representation. The time is related to the clock on * which the timer is based. + * @state: state of the timer * @function: timer expiry callback function + * @data: argument for the callback function * @base: pointer to the timer base (per cpu and per clock) * * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE() @@ -52,35 +63,23 @@ struct hrtimer_base; struct hrtimer { struct rb_node node; ktime_t expires; - int (*function)(struct hrtimer *); + enum hrtimer_state state; + int (*function)(void *); + void *data; struct hrtimer_base *base; }; -/** - * struct hrtimer_sleeper - simple sleeper structure - * @timer: embedded timer structure - * @task: task to wake up - * - * task is set to NULL, when the timer expires. - */ -struct hrtimer_sleeper { - struct hrtimer timer; - struct task_struct *task; -}; - /** * struct hrtimer_base - the timer base for a specific clock - * @index: clock type index for per_cpu support when moving a timer - * to a base on another cpu. - * @lock: lock protecting the base and associated timers - * @active: red black tree root node for the active timers - * @first: pointer to the timer node which expires first - * @resolution: the resolution of the clock, in nanoseconds - * @get_time: function to retrieve the current time of the clock - * @get_softirq_time: function to retrieve the current time from the softirq - * @curr_timer: the timer which is executing a callback right now - * @softirq_time: the time when running the hrtimer queue in the softirq - * @lock_key: the lock_class_key for use with lockdep + * + * @index: clock type index for per_cpu support when moving a timer + * to a base on another cpu. + * @lock: lock protecting the base and associated timers + * @active: red black tree root node for the active timers + * @first: pointer to the timer node which expires first + * @resolution: the resolution of the clock, in nanoseconds + * @get_time: function to retrieve the current time of the clock + * @curr_timer: the timer which is executing a callback right now */ struct hrtimer_base { clockid_t index; @@ -89,10 +88,7 @@ struct hrtimer_base { struct rb_node *first; ktime_t resolution; ktime_t (*get_time)(void); - ktime_t (*get_softirq_time)(void); struct hrtimer *curr_timer; - ktime_t softirq_time; - struct lock_class_key lock_key; }; /* @@ -126,12 +122,11 @@ extern ktime_t hrtimer_get_next_event(void); static inline int hrtimer_active(const struct hrtimer *timer) { - return rb_parent(&timer->node) != &timer->node; + return timer->state == HRTIMER_PENDING; } /* Forward a hrtimer so it expires after now: */ -extern unsigned long -hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval); +extern unsigned long hrtimer_forward(struct hrtimer *timer, ktime_t interval); /* Precise sleep: */ extern long hrtimer_nanosleep(struct timespec *rqtp, @@ -139,9 +134,6 @@ extern long hrtimer_nanosleep(struct timespec *rqtp, const enum hrtimer_mode mode, const clockid_t clockid); -extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, - struct task_struct *tsk); - /* Soft interrupt function to run the hrtimer queues: */ extern void hrtimer_run_queues(void);