This allows the rb_find_add() comparator to modify existing entries.

Signed-off-by: Peter Zijlstra (Intel) <pet...@infradead.org>
---
 include/linux/rbtree.h       |    2 +-
 kernel/events/uprobes.c      |    2 +-
 tools/include/linux/rbtree.h |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

--- a/include/linux/rbtree.h
+++ b/include/linux/rbtree.h
@@ -248,7 +248,7 @@ rb_add(struct rb_node *node, struct rb_r
  */
 static __always_inline struct rb_node *
 rb_find_add(struct rb_node *node, struct rb_root *tree,
-           int (*cmp)(struct rb_node *, const struct rb_node *))
+           int (*cmp)(struct rb_node *, struct rb_node *))
 {
        struct rb_node **link = &tree->rb_node;
        struct rb_node *parent = NULL;
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -646,7 +646,7 @@ static inline int __uprobe_cmp_key(const
        return uprobe_cmp(a->inode, a->offset, __node_2_uprobe(b));
 }
 
-static inline int __uprobe_cmp(struct rb_node *a, const struct rb_node *b)
+static inline int __uprobe_cmp(struct rb_node *a, struct rb_node *b)
 {
        struct uprobe *u = __node_2_uprobe(a);
        return uprobe_cmp(u->inode, u->offset, __node_2_uprobe(b));
--- a/tools/include/linux/rbtree.h
+++ b/tools/include/linux/rbtree.h
@@ -232,7 +232,7 @@ rb_add(struct rb_node *node, struct rb_r
  */
 static __always_inline struct rb_node *
 rb_find_add(struct rb_node *node, struct rb_root *tree,
-           int (*cmp)(struct rb_node *, const struct rb_node *))
+           int (*cmp)(struct rb_node *, struct rb_node *))
 {
        struct rb_node **link = &tree->rb_node;
        struct rb_node *parent = NULL;


Reply via email to