mirror of
https://kernel.googlesource.com/pub/scm/linux/kernel/git/torvalds/linux
synced 2025-09-14 08:36:46 +10:00
The timerlist infrastructure is a thin layer over the rbtree code that implements a simple list of timers sorted by an expires value, and a getnext function that provides a pointer to the earliest timer. This infrastructure allows drivers and other kernel infrastructure to easily implement timers without duplicating code. Signed-off-by: John Stultz <john.stultz@linaro.org> LKML Reference: <1290136329-18291-2-git-send-email-john.stultz@linaro.org> Reviewed-by: Thomas Gleixner <tglx@linutronix.de> CC: Alessandro Zummo <a.zummo@towertech.it> CC: Thomas Gleixner <tglx@linutronix.de> CC: Richard Cochran <richardcochran@gmail.com>
38 lines
848 B
C
38 lines
848 B
C
#ifndef _LINUX_TIMERLIST_H
|
|
#define _LINUX_TIMERLIST_H
|
|
|
|
#include <linux/rbtree.h>
|
|
#include <linux/ktime.h>
|
|
|
|
|
|
struct timerlist_node {
|
|
struct rb_node node;
|
|
ktime_t expires;
|
|
};
|
|
|
|
struct timerlist_head {
|
|
struct rb_root head;
|
|
struct timerlist_node *next;
|
|
};
|
|
|
|
|
|
extern void timerlist_add(struct timerlist_head *head,
|
|
struct timerlist_node *node);
|
|
extern void timerlist_del(struct timerlist_head *head,
|
|
struct timerlist_node *node);
|
|
extern struct timerlist_node *timerlist_getnext(struct timerlist_head *head);
|
|
extern struct timerlist_node *timerlist_iterate_next(
|
|
struct timerlist_node *node);
|
|
|
|
static inline void timerlist_init(struct timerlist_node *node)
|
|
{
|
|
RB_CLEAR_NODE(&node->node);
|
|
}
|
|
|
|
static inline void timerlist_init_head(struct timerlist_head *head)
|
|
{
|
|
head->head = RB_ROOT;
|
|
head->next = NULL;
|
|
}
|
|
#endif /* _LINUX_TIMERLIST_H */
|