Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934913AbcLTODz (ORCPT ); Tue, 20 Dec 2016 09:03:55 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:35895 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934561AbcLTODn (ORCPT ); Tue, 20 Dec 2016 09:03:43 -0500 From: Geliang Tang To: Boris Ostrovsky , Juergen Gross Cc: Geliang Tang , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Subject: [PATCH] xen/evtchn: use rb_entry() Date: Tue, 20 Dec 2016 22:02:20 +0800 Message-Id: <56f3df3380cd7214ce0b2e151f2aa757b0eaca2c.1482205472.git.geliangtang@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 999 Lines: 32 To make the code clearer, use rb_entry() instead of container_of() to deal with rbtree. Signed-off-by: Geliang Tang --- 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; -- 2.9.3