From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751698AbdAVOme (ORCPT ); Sun, 22 Jan 2017 09:42:34 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:32893 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751371AbdAVOmb (ORCPT ); Sun, 22 Jan 2017 09:42:31 -0500 Date: Sun, 22 Jan 2017 22:42:25 +0800 From: Geliang Tang To: Leon Romanovsky Cc: Yishai Hadas , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net/mlx4: use rb_entry() Message-ID: <20170122144225.lvkakc7db7fs2xpq@ThinkPad> References: <6c1c772de8f70113580dade04f89a377174d8c88.1484817025.git.geliangtang@gmail.com> <20170122074839.GD28570@mtr-leonro.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170122074839.GD28570@mtr-leonro.local> User-Agent: Mutt/1.6.2-neo (2016-08-21) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 22, 2017 at 09:48:39AM +0200, Leon Romanovsky wrote: > On Fri, Jan 20, 2017 at 10:36:57PM +0800, Geliang Tang wrote: > > To make the code clearer, use rb_entry() instead of container_of() to > > deal with rbtree. > > > > Signed-off-by: Geliang Tang > > --- > > drivers/net/ethernet/mellanox/mlx4/resource_tracker.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > I don't understand completely the rationale behind this conversion. > rb_entry == container_of, why do we need another name for it? > There are several *_entry macros which are defined in kernel data structures, like list_entry, hlist_entry, rb_entry, etc. Each of them is just another name for container_of. We use different *_entry so that we could identify the specific type of data structure that we are dealing with. -Geliang