diff options
Diffstat (limited to 'include/linux/hrtimer.h')
-rw-r--r-- | include/linux/hrtimer.h | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 7a9398e19704..8371b664b41f 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -115,10 +115,8 @@ struct hrtimer { | |||
115 | enum hrtimer_restart (*function)(struct hrtimer *); | 115 | enum hrtimer_restart (*function)(struct hrtimer *); |
116 | struct hrtimer_clock_base *base; | 116 | struct hrtimer_clock_base *base; |
117 | unsigned long state; | 117 | unsigned long state; |
118 | #ifdef CONFIG_HIGH_RES_TIMERS | ||
119 | enum hrtimer_cb_mode cb_mode; | 118 | enum hrtimer_cb_mode cb_mode; |
120 | struct list_head cb_entry; | 119 | struct list_head cb_entry; |
121 | #endif | ||
122 | #ifdef CONFIG_TIMER_STATS | 120 | #ifdef CONFIG_TIMER_STATS |
123 | void *start_site; | 121 | void *start_site; |
124 | char start_comm[16]; | 122 | char start_comm[16]; |
@@ -149,7 +147,6 @@ struct hrtimer_sleeper { | |||
149 | * @get_time: function to retrieve the current time of the clock | 147 | * @get_time: function to retrieve the current time of the clock |
150 | * @get_softirq_time: function to retrieve the current time from the softirq | 148 | * @get_softirq_time: function to retrieve the current time from the softirq |
151 | * @softirq_time: the time when running the hrtimer queue in the softirq | 149 | * @softirq_time: the time when running the hrtimer queue in the softirq |
152 | * @cb_pending: list of timers where the callback is pending | ||
153 | * @offset: offset of this clock to the monotonic base | 150 | * @offset: offset of this clock to the monotonic base |
154 | * @reprogram: function to reprogram the timer event | 151 | * @reprogram: function to reprogram the timer event |
155 | */ | 152 | */ |
@@ -194,10 +191,10 @@ struct hrtimer_cpu_base { | |||
194 | spinlock_t lock; | 191 | spinlock_t lock; |
195 | struct lock_class_key lock_key; | 192 | struct lock_class_key lock_key; |
196 | struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; | 193 | struct hrtimer_clock_base clock_base[HRTIMER_MAX_CLOCK_BASES]; |
194 | struct list_head cb_pending; | ||
197 | #ifdef CONFIG_HIGH_RES_TIMERS | 195 | #ifdef CONFIG_HIGH_RES_TIMERS |
198 | ktime_t expires_next; | 196 | ktime_t expires_next; |
199 | int hres_active; | 197 | int hres_active; |
200 | struct list_head cb_pending; | ||
201 | unsigned long nr_events; | 198 | unsigned long nr_events; |
202 | #endif | 199 | #endif |
203 | }; | 200 | }; |
@@ -217,6 +214,11 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer) | |||
217 | return timer->base->get_time(); | 214 | return timer->base->get_time(); |
218 | } | 215 | } |
219 | 216 | ||
217 | static inline int hrtimer_is_hres_active(struct hrtimer *timer) | ||
218 | { | ||
219 | return timer->base->cpu_base->hres_active; | ||
220 | } | ||
221 | |||
220 | /* | 222 | /* |
221 | * The resolution of the clocks. The resolution value is returned in | 223 | * The resolution of the clocks. The resolution value is returned in |
222 | * the clock_getres() system call to give application programmers an | 224 | * the clock_getres() system call to give application programmers an |
@@ -248,6 +250,10 @@ static inline ktime_t hrtimer_cb_get_time(struct hrtimer *timer) | |||
248 | return timer->base->softirq_time; | 250 | return timer->base->softirq_time; |
249 | } | 251 | } |
250 | 252 | ||
253 | static inline int hrtimer_is_hres_active(struct hrtimer *timer) | ||
254 | { | ||
255 | return 0; | ||
256 | } | ||
251 | #endif | 257 | #endif |
252 | 258 | ||
253 | extern ktime_t ktime_get(void); | 259 | extern ktime_t ktime_get(void); |
@@ -295,9 +301,16 @@ static inline int hrtimer_is_queued(struct hrtimer *timer) | |||
295 | } | 301 | } |
296 | 302 | ||
297 | /* Forward a hrtimer so it expires after now: */ | 303 | /* Forward a hrtimer so it expires after now: */ |
298 | extern unsigned long | 304 | extern u64 |
299 | hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval); | 305 | hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval); |
300 | 306 | ||
307 | /* Forward a hrtimer so it expires after the hrtimer's current now */ | ||
308 | static inline u64 hrtimer_forward_now(struct hrtimer *timer, | ||
309 | ktime_t interval) | ||
310 | { | ||
311 | return hrtimer_forward(timer, timer->base->get_time(), interval); | ||
312 | } | ||
313 | |||
301 | /* Precise sleep: */ | 314 | /* Precise sleep: */ |
302 | extern long hrtimer_nanosleep(struct timespec *rqtp, | 315 | extern long hrtimer_nanosleep(struct timespec *rqtp, |
303 | struct timespec *rmtp, | 316 | struct timespec *rmtp, |
@@ -310,14 +323,15 @@ extern void hrtimer_init_sleeper(struct hrtimer_sleeper *sl, | |||
310 | 323 | ||
311 | /* Soft interrupt function to run the hrtimer queues: */ | 324 | /* Soft interrupt function to run the hrtimer queues: */ |
312 | extern void hrtimer_run_queues(void); | 325 | extern void hrtimer_run_queues(void); |
326 | extern void hrtimer_run_pending(void); | ||
313 | 327 | ||
314 | /* Bootup initialization: */ | 328 | /* Bootup initialization: */ |
315 | extern void __init hrtimers_init(void); | 329 | extern void __init hrtimers_init(void); |
316 | 330 | ||
317 | #if BITS_PER_LONG < 64 | 331 | #if BITS_PER_LONG < 64 |
318 | extern unsigned long ktime_divns(const ktime_t kt, s64 div); | 332 | extern u64 ktime_divns(const ktime_t kt, s64 div); |
319 | #else /* BITS_PER_LONG < 64 */ | 333 | #else /* BITS_PER_LONG < 64 */ |
320 | # define ktime_divns(kt, div) (unsigned long)((kt).tv64 / (div)) | 334 | # define ktime_divns(kt, div) (u64)((kt).tv64 / (div)) |
321 | #endif | 335 | #endif |
322 | 336 | ||
323 | /* Show pending timers: */ | 337 | /* Show pending timers: */ |