aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/rbtree.h
diff options
context:
space:
mode:
authorJohn Stultz <john.stultz@linaro.org>2011-01-03 21:59:43 -0500
committerJohn Stultz <john.stultz@linaro.org>2011-04-26 17:01:42 -0400
commit88d19cf37952a7e1e38b2bf87a00f0e857e63180 (patch)
treefdd409b1588005bb71b3cd0bf5fbe55a3dd68643 /include/linux/rbtree.h
parent304529b1b6f8612ccbb4582e997051b48b94f4a4 (diff)
timers: Add rb_init_node() to allow for stack allocated rb nodes
In cases where a timerqueue_node or some structure that utilizes a timerqueue_node is allocated on the stack, gcc would give warnings caused by the timerqueue_init()'s calling RB_CLEAR_NODE, which self-references the nodes uninitialized data. The solution is to create an rb_init_node() function that zeros the rb_node structure out and then calls RB_CLEAR_NODE(), and then call the new init function from timerqueue_init(). CC: Thomas Gleixner <tglx@linutronix.de> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: John Stultz <john.stultz@linaro.org>
Diffstat (limited to 'include/linux/rbtree.h')
-rw-r--r--include/linux/rbtree.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/rbtree.h b/include/linux/rbtree.h
index 7066acb2c530..033b507b33b1 100644
--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -136,6 +136,14 @@ static inline void rb_set_color(struct rb_node *rb, int color)
136#define RB_EMPTY_NODE(node) (rb_parent(node) == node) 136#define RB_EMPTY_NODE(node) (rb_parent(node) == node)
137#define RB_CLEAR_NODE(node) (rb_set_parent(node, node)) 137#define RB_CLEAR_NODE(node) (rb_set_parent(node, node))
138 138
139static inline void rb_init_node(struct rb_node *rb)
140{
141 rb->rb_parent_color = 0;
142 rb->rb_right = NULL;
143 rb->rb_left = NULL;
144 RB_CLEAR_NODE(rb);
145}
146
139extern void rb_insert_color(struct rb_node *, struct rb_root *); 147extern void rb_insert_color(struct rb_node *, struct rb_root *);
140extern void rb_erase(struct rb_node *, struct rb_root *); 148extern void rb_erase(struct rb_node *, struct rb_root *);
141 149