Skip to content

Commit

Permalink
xen/evtchn: use rb_entry()
Browse files Browse the repository at this point in the history
To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
  • Loading branch information
Geliang Tang authored and Juergen Gross committed Dec 22, 2016
1 parent 7ecec85 commit 2f60b28
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/xen/evtchn.c
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ static int add_evtchn(struct per_user_data *u, struct user_evtchn *evtchn)
while (*new) {
struct user_evtchn *this;

this = container_of(*new, struct user_evtchn, node);
this = rb_entry(*new, struct user_evtchn, node);

parent = *new;
if (this->port < evtchn->port)
@@ -157,7 +157,7 @@ static struct user_evtchn *find_evtchn(struct per_user_data *u, unsigned port)
while (node) {
struct user_evtchn *evtchn;

evtchn = container_of(node, struct user_evtchn, node);
evtchn = rb_entry(node, struct user_evtchn, node);

if (evtchn->port < port)
node = node->rb_left;

0 comments on commit 2f60b28

Please sign in to comment.