Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758336AbcLTQUY (ORCPT ); Tue, 20 Dec 2016 11:20:24 -0500 Received: from mx2.suse.de ([195.135.220.15]:53480 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755280AbcLTQUV (ORCPT ); Tue, 20 Dec 2016 11:20:21 -0500 Subject: Re: [PATCH] xen/evtchn: use rb_entry() To: Geliang Tang , Boris Ostrovsky References: <56f3df3380cd7214ce0b2e151f2aa757b0eaca2c.1482205472.git.geliangtang@gmail.com> Cc: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org From: Juergen Gross Message-ID: <0c829b89-7ff4-6da8-693e-05e3c5edf5a2@suse.com> Date: Tue, 20 Dec 2016 17:20:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <56f3df3380cd7214ce0b2e151f2aa757b0eaca2c.1482205472.git.geliangtang@gmail.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1138 Lines: 35 On 20/12/16 15:02, Geliang Tang wrote: > To make the code clearer, use rb_entry() instead of container_of() to > deal with rbtree. > > Signed-off-by: Geliang Tang Reviewed-by: Juergen Gross > --- > drivers/xen/evtchn.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/xen/evtchn.c b/drivers/xen/evtchn.c > index e8c7f09..6890897 100644 > --- a/drivers/xen/evtchn.c > +++ b/drivers/xen/evtchn.c > @@ -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; >