diff options
Diffstat (limited to 'include/linux/hrtimer.h')
-rw-r--r-- | include/linux/hrtimer.h | 41 |
1 files changed, 17 insertions, 24 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 6401c31d6add..93830158348e 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -34,15 +34,7 @@ enum hrtimer_restart { | |||
34 | HRTIMER_RESTART, | 34 | HRTIMER_RESTART, |
35 | }; | 35 | }; |
36 | 36 | ||
37 | /* | 37 | #define HRTIMER_INACTIVE ((void *)1UL) |
38 | * Timer states: | ||
39 | */ | ||
40 | enum hrtimer_state { | ||
41 | HRTIMER_INACTIVE, /* Timer is inactive */ | ||
42 | HRTIMER_EXPIRED, /* Timer is expired */ | ||
43 | HRTIMER_RUNNING, /* Timer is running the callback function */ | ||
44 | HRTIMER_PENDING, /* Timer is pending */ | ||
45 | }; | ||
46 | 38 | ||
47 | struct hrtimer_base; | 39 | struct hrtimer_base; |
48 | 40 | ||
@@ -53,9 +45,7 @@ struct hrtimer_base; | |||
53 | * @expires: the absolute expiry time in the hrtimers internal | 45 | * @expires: the absolute expiry time in the hrtimers internal |
54 | * representation. The time is related to the clock on | 46 | * representation. The time is related to the clock on |
55 | * which the timer is based. | 47 | * which the timer is based. |
56 | * @state: state of the timer | ||
57 | * @function: timer expiry callback function | 48 | * @function: timer expiry callback function |
58 | * @data: argument for the callback function | ||
59 | * @base: pointer to the timer base (per cpu and per clock) | 49 | * @base: pointer to the timer base (per cpu and per clock) |
60 | * | 50 | * |
61 | * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE() | 51 | * The hrtimer structure must be initialized by init_hrtimer_#CLOCKTYPE() |
@@ -63,23 +53,23 @@ struct hrtimer_base; | |||
63 | struct hrtimer { | 53 | struct hrtimer { |
64 | struct rb_node node; | 54 | struct rb_node node; |
65 | ktime_t expires; | 55 | ktime_t expires; |
66 | enum hrtimer_state state; | 56 | int (*function)(struct hrtimer *); |
67 | int (*function)(void *); | ||
68 | void *data; | ||
69 | struct hrtimer_base *base; | 57 | struct hrtimer_base *base; |
70 | }; | 58 | }; |
71 | 59 | ||
72 | /** | 60 | /** |
73 | * struct hrtimer_base - the timer base for a specific clock | 61 | * struct hrtimer_base - the timer base for a specific clock |
74 | * | 62 | * |
75 | * @index: clock type index for per_cpu support when moving a timer | 63 | * @index: clock type index for per_cpu support when moving a timer |
76 | * to a base on another cpu. | 64 | * to a base on another cpu. |
77 | * @lock: lock protecting the base and associated timers | 65 | * @lock: lock protecting the base and associated timers |
78 | * @active: red black tree root node for the active timers | 66 | * @active: red black tree root node for the active timers |
79 | * @first: pointer to the timer node which expires first | 67 | * @first: pointer to the timer node which expires first |
80 | * @resolution: the resolution of the clock, in nanoseconds | 68 | * @resolution: the resolution of the clock, in nanoseconds |
81 | * @get_time: function to retrieve the current time of the clock | 69 | * @get_time: function to retrieve the current time of the clock |
82 | * @curr_timer: the timer which is executing a callback right now | 70 | * @get_sofirq_time: function to retrieve the current time from the softirq |
71 | * @curr_timer: the timer which is executing a callback right now | ||
72 | * @softirq_time: the time when running the hrtimer queue in the softirq | ||
83 | */ | 73 | */ |
84 | struct hrtimer_base { | 74 | struct hrtimer_base { |
85 | clockid_t index; | 75 | clockid_t index; |
@@ -88,7 +78,9 @@ struct hrtimer_base { | |||
88 | struct rb_node *first; | 78 | struct rb_node *first; |
89 | ktime_t resolution; | 79 | ktime_t resolution; |
90 | ktime_t (*get_time)(void); | 80 | ktime_t (*get_time)(void); |
81 | ktime_t (*get_softirq_time)(void); | ||
91 | struct hrtimer *curr_timer; | 82 | struct hrtimer *curr_timer; |
83 | ktime_t softirq_time; | ||
92 | }; | 84 | }; |
93 | 85 | ||
94 | /* | 86 | /* |
@@ -122,11 +114,12 @@ extern ktime_t hrtimer_get_next_event(void); | |||
122 | 114 | ||
123 | static inline int hrtimer_active(const struct hrtimer *timer) | 115 | static inline int hrtimer_active(const struct hrtimer *timer) |
124 | { | 116 | { |
125 | return timer->state == HRTIMER_PENDING; | 117 | return timer->node.rb_parent != HRTIMER_INACTIVE; |
126 | } | 118 | } |
127 | 119 | ||
128 | /* Forward a hrtimer so it expires after now: */ | 120 | /* Forward a hrtimer so it expires after now: */ |
129 | extern unsigned long hrtimer_forward(struct hrtimer *timer, ktime_t interval); | 121 | extern unsigned long |
122 | hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval); | ||
130 | 123 | ||
131 | /* Precise sleep: */ | 124 | /* Precise sleep: */ |
132 | extern long hrtimer_nanosleep(struct timespec *rqtp, | 125 | extern long hrtimer_nanosleep(struct timespec *rqtp, |