Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764673AbcLVJHd (ORCPT ); Thu, 22 Dec 2016 04:07:33 -0500 Received: from mx2.suse.de ([195.135.220.15]:55022 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759174AbcLVJHb (ORCPT ); Thu, 22 Dec 2016 04:07:31 -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: <32763218-c757-47ac-5b53-7dcfb6a7aafa@suse.com> Date: Thu, 22 Dec 2016 10:07:13 +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: 1143 Lines: 38 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 Committed to xen/tip.git for-linus-4.10 Juergen > --- > 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; >