linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Geliang Tang <geliangtang@gmail.com>
Cc: Mike Marciniszyn <infinipath@intel.com>,
	Doug Ledford <dledford@redhat.com>,
	Sean Hefty <sean.hefty@intel.com>,
	Hal Rosenstock <hal.rosenstock@gmail.com>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] IB/qib: use rb_entry()
Date: Tue, 20 Dec 2016 16:21:27 +0200	[thread overview]
Message-ID: <20161220142127.GZ1074@mtr-leonro.local> (raw)
In-Reply-To: <b3d122a5a5a74579c4854cde74974e2cbc140be0.1482203536.git.geliangtang@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1418 bytes --]

On Tue, Dec 20, 2016 at 10:02:12PM +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 <geliangtang@gmail.com>
> ---
>  drivers/infiniband/hw/qib/qib_user_sdma.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

> diff --git a/drivers/infiniband/hw/qib/qib_user_sdma.c b/drivers/infiniband/hw/qib/qib_user_sdma.c
> index 3e0677c..926f3c8 100644
> --- a/drivers/infiniband/hw/qib/qib_user_sdma.c
> +++ b/drivers/infiniband/hw/qib/qib_user_sdma.c
> @@ -144,8 +144,8 @@ qib_user_sdma_rb_search(struct rb_root *root, pid_t pid)
>  	struct rb_node *node = root->rb_node;
>
>  	while (node) {
> -		sdma_rb_node = container_of(node,
> -			struct qib_user_sdma_rb_node, node);
> +		sdma_rb_node = rb_entry(node, struct qib_user_sdma_rb_node,
> +					node);
>  		if (pid < sdma_rb_node->pid)
>  			node = node->rb_left;
>  		else if (pid > sdma_rb_node->pid)
> @@ -164,7 +164,7 @@ qib_user_sdma_rb_insert(struct rb_root *root, struct qib_user_sdma_rb_node *new)
>  	struct qib_user_sdma_rb_node *got;
>
>  	while (*node) {
> -		got = container_of(*node, struct qib_user_sdma_rb_node, node);
> +		got = rb_entry(*node, struct qib_user_sdma_rb_node, node);
>  		parent = *node;
>  		if (new->pid < got->pid)
>  			node = &((*node)->rb_left);
> --
> 2.9.3
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2016-12-20 14:21 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-20 14:02 [PATCH] dm bufio: use rb_entry() Geliang Tang
2016-12-20 14:02 ` [PATCH] drm/nouveau/dma: " Geliang Tang
2016-12-21 23:22   ` [Nouveau] " Ben Skeggs
2016-12-20 14:02 ` [PATCH] IB/qib: " Geliang Tang
2016-12-20 14:21   ` Leon Romanovsky [this message]
2016-12-20 15:01   ` Dennis Dalessandro
2016-12-20 19:34   ` Marciniszyn, Mike
2017-01-12 17:09   ` Doug Ledford
2016-12-20 14:02 ` [PATCH] netfilter: xt_connlimit: " Geliang Tang
2017-01-05 12:26   ` Pablo Neira Ayuso
2016-12-20 14:02 ` [PATCH] net/mlx5: " Geliang Tang
2016-12-20 14:19   ` Leon Romanovsky
2016-12-20 19:23   ` David Miller
2016-12-20 14:02 ` [PATCH] net_sched: sch_fq: " Geliang Tang
2016-12-20 16:38   ` Eric Dumazet
2016-12-20 19:23   ` David Miller
2016-12-20 14:02 ` [PATCH] net_sched: sch_netem: " Geliang Tang
2016-12-20 19:23   ` David Miller
2016-12-20 14:02 ` [PATCH] powerpc/perf/24x7: use rb_entry Geliang Tang
2019-07-08  1:19   ` Michael Ellerman
2016-12-20 14:02 ` [PATCH] RDS: use rb_entry() Geliang Tang
2016-12-20 14:20   ` Leon Romanovsky
2016-12-20 16:34   ` Santosh Shilimkar
2016-12-20 19:23   ` David Miller
2016-12-22  3:33   ` Doug Ledford
2016-12-20 14:02 ` [PATCH] xen/blkback: " Geliang Tang
2016-12-20 16:47   ` Konrad Rzeszutek Wilk
2016-12-20 17:44     ` Roger Pau Monné
2016-12-20 17:51       ` Konrad Rzeszutek Wilk
2016-12-20 21:53         ` Eric Dumazet
2016-12-20 22:07           ` Konrad Rzeszutek Wilk
2016-12-20 14:02 ` [PATCH] xen/evtchn: " Geliang Tang
2016-12-20 16:20   ` Juergen Gross
2016-12-22  9:07   ` Juergen Gross

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161220142127.GZ1074@mtr-leonro.local \
    --to=leon@kernel.org \
    --cc=dledford@redhat.com \
    --cc=geliangtang@gmail.com \
    --cc=hal.rosenstock@gmail.com \
    --cc=infinipath@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=sean.hefty@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).