/* Routine adds class to the list (actually tree) sorted by classid. Make sure that class is not already on such list for given prio.  */
static void htb_add_to_id_tree(struct rb_root *root, struct htb_class *cl, int prio)
/* Routine adds class to the list (actually tree) sorted by classid. Make sure that class is not already on such list for given prio.  */
static void htb_add_to_id_tree(struct rb_root *root, struct htb_class *cl, int prio)
{
	struct rb_node **p = &root->rb_node, *parent = NULL;
	while (*p) {
		struct htb_class *c;
		parent = *p;
		c = rb_entry(parent, struct htb_class, node[prio]);
		if (cl->common.classid > c->common.classid)
			p = &parent->rb_right;
		else
			p = &parent->rb_left;
	}
	rb_link_node(&cl->node[prio], parent, p);
	rb_insert_color(&cl->node[prio], root);
}