diff options
| author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2011-05-10 14:52:07 -0400 |
|---|---|---|
| committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2011-05-10 16:50:41 -0400 |
| commit | 020abf03cd659388f94cb328e1e1df0656e0d7ff (patch) | |
| tree | 40d05011708ad1b4a05928d167eb120420581aa6 /include/linux/timerqueue.h | |
| parent | 0ff8fbc61727c926883eec381fbd3d32d1fab504 (diff) | |
| parent | 693d92a1bbc9e42681c42ed190bd42b636ca876f (diff) | |
Merge tag 'v2.6.39-rc7'
in order to pull in changes in drivers/media/dvb/firewire/ and
sound/firewire/.
Diffstat (limited to 'include/linux/timerqueue.h')
| -rw-r--r-- | include/linux/timerqueue.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/include/linux/timerqueue.h b/include/linux/timerqueue.h new file mode 100644 index 000000000000..a520fd70a59f --- /dev/null +++ b/include/linux/timerqueue.h | |||
| @@ -0,0 +1,50 @@ | |||
| 1 | #ifndef _LINUX_TIMERQUEUE_H | ||
| 2 | #define _LINUX_TIMERQUEUE_H | ||
| 3 | |||
| 4 | #include <linux/rbtree.h> | ||
| 5 | #include <linux/ktime.h> | ||
| 6 | |||
| 7 | |||
| 8 | struct timerqueue_node { | ||
| 9 | struct rb_node node; | ||
| 10 | ktime_t expires; | ||
| 11 | }; | ||
| 12 | |||
| 13 | struct timerqueue_head { | ||
| 14 | struct rb_root head; | ||
| 15 | struct timerqueue_node *next; | ||
| 16 | }; | ||
| 17 | |||
| 18 | |||
| 19 | extern void timerqueue_add(struct timerqueue_head *head, | ||
| 20 | struct timerqueue_node *node); | ||
| 21 | extern void timerqueue_del(struct timerqueue_head *head, | ||
| 22 | struct timerqueue_node *node); | ||
| 23 | extern struct timerqueue_node *timerqueue_iterate_next( | ||
| 24 | struct timerqueue_node *node); | ||
| 25 | |||
| 26 | /** | ||
| 27 | * timerqueue_getnext - Returns the timer with the earliest expiration time | ||
| 28 | * | ||
| 29 | * @head: head of timerqueue | ||
| 30 | * | ||
| 31 | * Returns a pointer to the timer node that has the | ||
| 32 | * earliest expiration time. | ||
| 33 | */ | ||
| 34 | static inline | ||
| 35 | struct timerqueue_node *timerqueue_getnext(struct timerqueue_head *head) | ||
| 36 | { | ||
| 37 | return head->next; | ||
| 38 | } | ||
| 39 | |||
| 40 | static inline void timerqueue_init(struct timerqueue_node *node) | ||
| 41 | { | ||
| 42 | RB_CLEAR_NODE(&node->node); | ||
| 43 | } | ||
| 44 | |||
| 45 | static inline void timerqueue_init_head(struct timerqueue_head *head) | ||
| 46 | { | ||
| 47 | head->head = RB_ROOT; | ||
| 48 | head->next = NULL; | ||
| 49 | } | ||
| 50 | #endif /* _LINUX_TIMERQUEUE_H */ | ||
