All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 6lowpan: use rb_entry()
@ 2017-01-20 14:36 Geliang Tang
  2017-01-20 14:36 ` [PATCH] dm bio prison: " Geliang Tang
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Geliang Tang @ 2017-01-20 14:36 UTC (permalink / raw)
  To: Alexander Aring, Jukka Rissanen, David S. Miller
  Cc: Geliang Tang, linux-bluetooth, linux-wpan, netdev, linux-kernel

To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 net/6lowpan/nhc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/net/6lowpan/nhc.c b/net/6lowpan/nhc.c
index 7008d53..4fa2fdd 100644
--- a/net/6lowpan/nhc.c
+++ b/net/6lowpan/nhc.c
@@ -27,8 +27,8 @@ static int lowpan_nhc_insert(struct lowpan_nhc *nhc)
 
 	/* Figure out where to put new node */
 	while (*new) {
-		struct lowpan_nhc *this = container_of(*new, struct lowpan_nhc,
-						       node);
+		struct lowpan_nhc *this = rb_entry(*new, struct lowpan_nhc,
+						   node);
 		int result, len_dif, len;
 
 		len_dif = nhc->idlen - this->idlen;
@@ -69,8 +69,8 @@ static struct lowpan_nhc *lowpan_nhc_by_nhcid(const struct sk_buff *skb)
 	const u8 *nhcid_skb_ptr = skb->data;
 
 	while (node) {
-		struct lowpan_nhc *nhc = container_of(node, struct lowpan_nhc,
-						      node);
+		struct lowpan_nhc *nhc = rb_entry(node, struct lowpan_nhc,
+						  node);
 		u8 nhcid_skb_ptr_masked[LOWPAN_NHC_MAX_ID_LEN];
 		int result, i;
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH] dm bio prison: use rb_entry()
  2017-01-20 14:36 [PATCH] 6lowpan: use rb_entry() Geliang Tang
@ 2017-01-20 14:36 ` Geliang Tang
  2017-01-20 15:12   ` Coly Li
  2017-01-20 14:36   ` Geliang Tang
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 19+ messages in thread
From: Geliang Tang @ 2017-01-20 14:36 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer, dm-devel, Shaohua Li
  Cc: Geliang Tang, linux-raid, linux-kernel

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/md/dm-bio-prison.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/md/dm-bio-prison.c b/drivers/md/dm-bio-prison.c
index 03af174..a2c8a9e 100644
--- a/drivers/md/dm-bio-prison.c
+++ b/drivers/md/dm-bio-prison.c
@@ -115,7 +115,7 @@ static int __bio_detain(struct dm_bio_prison *prison,
 
 	while (*new) {
 		struct dm_bio_prison_cell *cell =
-			container_of(*new, struct dm_bio_prison_cell, node);
+			rb_entry(*new, struct dm_bio_prison_cell, node);
 
 		r = cmp_keys(key, &cell->key);
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH] drm/i915/error: use rb_entry()
  2017-01-20 14:36 [PATCH] 6lowpan: use rb_entry() Geliang Tang
@ 2017-01-20 14:36   ` Geliang Tang
  2017-01-20 14:36   ` Geliang Tang
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 19+ messages in thread
From: Geliang Tang @ 2017-01-20 14:36 UTC (permalink / raw)
  To: Daniel Vetter, Jani Nikula, David Airlie
  Cc: Geliang Tang, intel-gfx, dri-devel, linux-kernel

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/gpu/drm/i915/i915_gpu_error.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 9cd22cd..e537532 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1080,7 +1080,7 @@ static void error_record_engine_waiters(struct intel_engine_cs *engine,
 
 	ee->waiters = waiter;
 	for (rb = rb_first(&b->waiters); rb; rb = rb_next(rb)) {
-		struct intel_wait *w = container_of(rb, typeof(*w), node);
+		struct intel_wait *w = rb_entry(rb, typeof(*w), node);
 
 		strcpy(waiter->comm, w->tsk->comm);
 		waiter->pid = w->tsk->pid;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH] drm/i915/error: use rb_entry()
@ 2017-01-20 14:36   ` Geliang Tang
  0 siblings, 0 replies; 19+ messages in thread
From: Geliang Tang @ 2017-01-20 14:36 UTC (permalink / raw)
  To: Daniel Vetter, Jani Nikula, David Airlie
  Cc: Geliang Tang, intel-gfx, linux-kernel, dri-devel

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/gpu/drm/i915/i915_gpu_error.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 9cd22cd..e537532 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -1080,7 +1080,7 @@ static void error_record_engine_waiters(struct intel_engine_cs *engine,
 
 	ee->waiters = waiter;
 	for (rb = rb_first(&b->waiters); rb; rb = rb_next(rb)) {
-		struct intel_wait *w = container_of(rb, typeof(*w), node);
+		struct intel_wait *w = rb_entry(rb, typeof(*w), node);
 
 		strcpy(waiter->comm, w->tsk->comm);
 		waiter->pid = w->tsk->pid;
-- 
2.9.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH] drm/nouveau/client: use rb_entry()
@ 2017-01-20 14:36   ` Geliang Tang
  0 siblings, 0 replies; 19+ messages in thread
From: Geliang Tang @ 2017-01-20 14:36 UTC (permalink / raw)
  To: Ben Skeggs, David Airlie; +Cc: Geliang Tang, dri-devel, nouveau, linux-kernel

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/gpu/drm/nouveau/nvkm/core/client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/core/client.c b/drivers/gpu/drm/nouveau/nvkm/core/client.c
index e194391..ab2ee14 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/client.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/client.c
@@ -221,7 +221,7 @@ nvkm_client_insert(struct nvkm_client *client, struct nvkm_object *object)
 
 	while (*ptr) {
 		struct nvkm_object *this =
-			container_of(*ptr, typeof(*this), node);
+			rb_entry(*ptr, typeof(*this), node);
 		parent = *ptr;
 		if (object->object < this->object)
 			ptr = &parent->rb_left;
@@ -243,7 +243,7 @@ nvkm_client_search(struct nvkm_client *client, u64 handle)
 	struct rb_node *node = client->objroot.rb_node;
 	while (node) {
 		struct nvkm_object *object =
-			container_of(node, typeof(*object), node);
+			rb_entry(node, typeof(*object), node);
 		if (handle < object->object)
 			node = node->rb_left;
 		else
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH] drm/nouveau/client: use rb_entry()
@ 2017-01-20 14:36   ` Geliang Tang
  0 siblings, 0 replies; 19+ messages in thread
From: Geliang Tang @ 2017-01-20 14:36 UTC (permalink / raw)
  To: Ben Skeggs, David Airlie
  Cc: Geliang Tang, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

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/gpu/drm/nouveau/nvkm/core/client.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/nvkm/core/client.c b/drivers/gpu/drm/nouveau/nvkm/core/client.c
index e194391..ab2ee14 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/client.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/client.c
@@ -221,7 +221,7 @@ nvkm_client_insert(struct nvkm_client *client, struct nvkm_object *object)
 
 	while (*ptr) {
 		struct nvkm_object *this =
-			container_of(*ptr, typeof(*this), node);
+			rb_entry(*ptr, typeof(*this), node);
 		parent = *ptr;
 		if (object->object < this->object)
 			ptr = &parent->rb_left;
@@ -243,7 +243,7 @@ nvkm_client_search(struct nvkm_client *client, u64 handle)
 	struct rb_node *node = client->objroot.rb_node;
 	while (node) {
 		struct nvkm_object *object =
-			container_of(node, typeof(*object), node);
+			rb_entry(node, typeof(*object), node);
 		if (handle < object->object)
 			node = node->rb_left;
 		else
-- 
2.9.3

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH] net/mlx4: use rb_entry()
  2017-01-20 14:36 [PATCH] 6lowpan: use rb_entry() Geliang Tang
                   ` (2 preceding siblings ...)
  2017-01-20 14:36   ` Geliang Tang
@ 2017-01-20 14:36 ` Geliang Tang
  2017-01-22  7:48   ` Leon Romanovsky
  2017-01-22 21:48   ` David Miller
  2017-01-20 15:24 ` ✗ Fi.CI.BAT: failure for drm/i915/error: " Patchwork
  2017-01-22 21:47 ` [PATCH] 6lowpan: " David Miller
  5 siblings, 2 replies; 19+ messages in thread
From: Geliang Tang @ 2017-01-20 14:36 UTC (permalink / raw)
  To: Yishai Hadas; +Cc: Geliang Tang, netdev, linux-rdma, linux-kernel

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/net/ethernet/mellanox/mlx4/resource_tracker.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
index 1822382..6da6e01 100644
--- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
+++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
@@ -236,8 +236,8 @@ static void *res_tracker_lookup(struct rb_root *root, u64 res_id)
 	struct rb_node *node = root->rb_node;
 
 	while (node) {
-		struct res_common *res = container_of(node, struct res_common,
-						      node);
+		struct res_common *res = rb_entry(node, struct res_common,
+						  node);
 
 		if (res_id < res->res_id)
 			node = node->rb_left;
@@ -255,8 +255,8 @@ static int res_tracker_insert(struct rb_root *root, struct res_common *res)
 
 	/* Figure out where to put new node */
 	while (*new) {
-		struct res_common *this = container_of(*new, struct res_common,
-						       node);
+		struct res_common *this = rb_entry(*new, struct res_common,
+						   node);
 
 		parent = *new;
 		if (res->res_id < this->res_id)
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH] dm bio prison: use rb_entry()
  2017-01-20 14:36 ` [PATCH] dm bio prison: " Geliang Tang
@ 2017-01-20 15:12   ` Coly Li
  2017-05-06 15:39     ` [PATCH v2] " Geliang Tang
  0 siblings, 1 reply; 19+ messages in thread
From: Coly Li @ 2017-01-20 15:12 UTC (permalink / raw)
  To: Geliang Tang, Alasdair Kergon, Mike Snitzer, dm-devel, Shaohua Li
  Cc: linux-raid, linux-kernel

On 2017/1/20 下午10:36, 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/md/dm-bio-prison.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/md/dm-bio-prison.c b/drivers/md/dm-bio-prison.c
> index 03af174..a2c8a9e 100644
> --- a/drivers/md/dm-bio-prison.c
> +++ b/drivers/md/dm-bio-prison.c
> @@ -115,7 +115,7 @@ static int __bio_detain(struct dm_bio_prison *prison,
>  
>  	while (*new) {
>  		struct dm_bio_prison_cell *cell =
> -			container_of(*new, struct dm_bio_prison_cell, node);
> +			rb_entry(*new, struct dm_bio_prison_cell, node);
>  
>  		r = cmp_keys(key, &cell->key);
>  
> 
Acked-by: Coly Li <colyli@suse.de>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* ✗ Fi.CI.BAT: failure for drm/i915/error: use rb_entry()
  2017-01-20 14:36 [PATCH] 6lowpan: use rb_entry() Geliang Tang
                   ` (3 preceding siblings ...)
  2017-01-20 14:36 ` [PATCH] net/mlx4: " Geliang Tang
@ 2017-01-20 15:24 ` Patchwork
  2017-01-22 21:47 ` [PATCH] 6lowpan: " David Miller
  5 siblings, 0 replies; 19+ messages in thread
From: Patchwork @ 2017-01-20 15:24 UTC (permalink / raw)
  To: Geliang Tang; +Cc: intel-gfx

== Series Details ==

Series: drm/i915/error: use rb_entry()
URL   : https://patchwork.freedesktop.org/series/18298/
State : failure

== Summary ==

Series 18298v1 drm/i915/error: use rb_entry()
https://patchwork.freedesktop.org/api/1.0/series/18298/revisions/1/mbox/

Test gem_busy:
        Subgroup basic-busy-default:
                pass       -> FAIL       (fi-ivb-3520m)

fi-bdw-5557u     total:246  pass:232  dwarn:0   dfail:0   fail:0   skip:14 
fi-bsw-n3050     total:246  pass:207  dwarn:0   dfail:0   fail:0   skip:39 
fi-bxt-j4205     total:246  pass:224  dwarn:0   dfail:0   fail:0   skip:22 
fi-bxt-t5700     total:79   pass:66   dwarn:0   dfail:0   fail:0   skip:12 
fi-byt-j1900     total:246  pass:219  dwarn:0   dfail:0   fail:0   skip:27 
fi-byt-n2820     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-hsw-4770      total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-hsw-4770r     total:246  pass:227  dwarn:0   dfail:0   fail:0   skip:19 
fi-ivb-3520m     total:246  pass:224  dwarn:0   dfail:0   fail:1   skip:21 
fi-ivb-3770      total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-kbl-7500u     total:246  pass:225  dwarn:0   dfail:0   fail:0   skip:21 
fi-skl-6260u     total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-skl-6700hq    total:246  pass:226  dwarn:0   dfail:0   fail:0   skip:20 
fi-skl-6700k     total:246  pass:222  dwarn:3   dfail:0   fail:0   skip:21 
fi-skl-6770hq    total:246  pass:233  dwarn:0   dfail:0   fail:0   skip:13 
fi-snb-2520m     total:246  pass:215  dwarn:0   dfail:0   fail:0   skip:31 
fi-snb-2600      total:246  pass:214  dwarn:0   dfail:0   fail:0   skip:32 

aa012aa081f6a6d2dd5a1df0f3c3736017df0d56 drm-tip: 2017y-01m-20d-09h-33m-30s UTC integration manifest
5d25acd drm/i915/error: use rb_entry()

== Logs ==

For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3558/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] drm/nouveau/client: use rb_entry()
       [not found]   ` <22da087ad757fafdb206fd0c57d286449302acdb.1484816560.git.geliangtang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2017-01-21  0:14     ` Ben Skeggs
  0 siblings, 0 replies; 19+ messages in thread
From: Ben Skeggs @ 2017-01-21  0:14 UTC (permalink / raw)
  To: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1.1: Type: text/plain, Size: 1416 bytes --]

On 01/21/2017 12:36 AM, Geliang Tang wrote:
> To make the code clearer, use rb_entry() instead of container_of() to
> deal with rbtree.
Hey Geliang,

Looks good, however, I've already got a patch handling this pending in
my tree.

Thank you!
Ben.

> 
> Signed-off-by: Geliang Tang <geliangtang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> ---
>  drivers/gpu/drm/nouveau/nvkm/core/client.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/nouveau/nvkm/core/client.c b/drivers/gpu/drm/nouveau/nvkm/core/client.c
> index e194391..ab2ee14 100644
> --- a/drivers/gpu/drm/nouveau/nvkm/core/client.c
> +++ b/drivers/gpu/drm/nouveau/nvkm/core/client.c
> @@ -221,7 +221,7 @@ nvkm_client_insert(struct nvkm_client *client, struct nvkm_object *object)
>  
>  	while (*ptr) {
>  		struct nvkm_object *this =
> -			container_of(*ptr, typeof(*this), node);
> +			rb_entry(*ptr, typeof(*this), node);
>  		parent = *ptr;
>  		if (object->object < this->object)
>  			ptr = &parent->rb_left;
> @@ -243,7 +243,7 @@ nvkm_client_search(struct nvkm_client *client, u64 handle)
>  	struct rb_node *node = client->objroot.rb_node;
>  	while (node) {
>  		struct nvkm_object *object =
> -			container_of(node, typeof(*object), node);
> +			rb_entry(node, typeof(*object), node);
>  		if (handle < object->object)
>  			node = node->rb_left;
>  		else
> 


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
Nouveau mailing list
Nouveau@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] net/mlx4: use rb_entry()
  2017-01-20 14:36 ` [PATCH] net/mlx4: " Geliang Tang
@ 2017-01-22  7:48   ` Leon Romanovsky
  2017-01-22 14:42     ` Geliang Tang
  2017-01-22 21:48     ` David Miller
  2017-01-22 21:48   ` David Miller
  1 sibling, 2 replies; 19+ messages in thread
From: Leon Romanovsky @ 2017-01-22  7:48 UTC (permalink / raw)
  To: Geliang Tang; +Cc: Yishai Hadas, netdev, linux-rdma, linux-kernel

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

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 <geliangtang@gmail.com>
> ---
>  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?

>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
> index 1822382..6da6e01 100644
> --- a/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
> +++ b/drivers/net/ethernet/mellanox/mlx4/resource_tracker.c
> @@ -236,8 +236,8 @@ static void *res_tracker_lookup(struct rb_root *root, u64 res_id)
>  	struct rb_node *node = root->rb_node;
>
>  	while (node) {
> -		struct res_common *res = container_of(node, struct res_common,
> -						      node);
> +		struct res_common *res = rb_entry(node, struct res_common,
> +						  node);
>
>  		if (res_id < res->res_id)
>  			node = node->rb_left;
> @@ -255,8 +255,8 @@ static int res_tracker_insert(struct rb_root *root, struct res_common *res)
>
>  	/* Figure out where to put new node */
>  	while (*new) {
> -		struct res_common *this = container_of(*new, struct res_common,
> -						       node);
> +		struct res_common *this = rb_entry(*new, struct res_common,
> +						   node);
>
>  		parent = *new;
>  		if (res->res_id < this->res_id)
> --
> 2.9.3
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] net/mlx4: use rb_entry()
  2017-01-22  7:48   ` Leon Romanovsky
@ 2017-01-22 14:42     ` Geliang Tang
  2017-01-22 19:05       ` Leon Romanovsky
  2017-01-22 21:48     ` David Miller
  1 sibling, 1 reply; 19+ messages in thread
From: Geliang Tang @ 2017-01-22 14:42 UTC (permalink / raw)
  To: Leon Romanovsky; +Cc: Yishai Hadas, netdev, linux-rdma, linux-kernel

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 <geliangtang@gmail.com>
> > ---
> >  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

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] net/mlx4: use rb_entry()
  2017-01-22 14:42     ` Geliang Tang
@ 2017-01-22 19:05       ` Leon Romanovsky
  0 siblings, 0 replies; 19+ messages in thread
From: Leon Romanovsky @ 2017-01-22 19:05 UTC (permalink / raw)
  To: Geliang Tang; +Cc: Yishai Hadas, netdev, linux-rdma, linux-kernel

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

On Sun, Jan 22, 2017 at 10:42:25PM +0800, Geliang Tang wrote:
> 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 <geliangtang@gmail.com>
> > > ---
> > >  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.

Your proposed patch doesn't support the importance of such knowledge for
rb_entry. The list_entry case is totally different, because you perform
operation on it.

Anyway, It doesn't matter.
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

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

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] 6lowpan: use rb_entry()
  2017-01-20 14:36 [PATCH] 6lowpan: use rb_entry() Geliang Tang
                   ` (4 preceding siblings ...)
  2017-01-20 15:24 ` ✗ Fi.CI.BAT: failure for drm/i915/error: " Patchwork
@ 2017-01-22 21:47 ` David Miller
  5 siblings, 0 replies; 19+ messages in thread
From: David Miller @ 2017-01-22 21:47 UTC (permalink / raw)
  To: geliangtang
  Cc: aar, jukka.rissanen, linux-bluetooth, linux-wpan, netdev, linux-kernel

From: Geliang Tang <geliangtang@gmail.com>
Date: Fri, 20 Jan 2017 22:36:53 +0800

> To make the code clearer, use rb_entry() instead of container_of() to
> deal with rbtree.
> 
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] net/mlx4: use rb_entry()
  2017-01-20 14:36 ` [PATCH] net/mlx4: " Geliang Tang
  2017-01-22  7:48   ` Leon Romanovsky
@ 2017-01-22 21:48   ` David Miller
  1 sibling, 0 replies; 19+ messages in thread
From: David Miller @ 2017-01-22 21:48 UTC (permalink / raw)
  To: geliangtang; +Cc: yishaih, netdev, linux-rdma, linux-kernel

From: Geliang Tang <geliangtang@gmail.com>
Date: Fri, 20 Jan 2017 22:36:57 +0800

> To make the code clearer, use rb_entry() instead of container_of() to
> deal with rbtree.
> 
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>

Applied.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] net/mlx4: use rb_entry()
  2017-01-22  7:48   ` Leon Romanovsky
  2017-01-22 14:42     ` Geliang Tang
@ 2017-01-22 21:48     ` David Miller
  1 sibling, 0 replies; 19+ messages in thread
From: David Miller @ 2017-01-22 21:48 UTC (permalink / raw)
  To: leon; +Cc: geliangtang, yishaih, netdev, linux-rdma, linux-kernel

From: Leon Romanovsky <leon@kernel.org>
Date: Sun, 22 Jan 2017 09:48:39 +0200

> I don't understand completely the rationale behind this conversion.
> rb_entry == container_of, why do we need another name for it?

Because it's an annotation.

Either you agree that the macro exists and it should be used in
every spot where those types are being used, or you don't and
therefore argue for the macro and it's usage completely.

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [Intel-gfx] [PATCH] drm/i915/error: use rb_entry()
  2017-01-20 14:36   ` Geliang Tang
@ 2017-01-23  9:10     ` Chris Wilson
  -1 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2017-01-23  9:10 UTC (permalink / raw)
  To: Geliang Tang
  Cc: Daniel Vetter, Jani Nikula, David Airlie, intel-gfx,
	linux-kernel, dri-devel

On Fri, Jan 20, 2017 at 10:36:55PM +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>

Applied, thanks.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] drm/i915/error: use rb_entry()
@ 2017-01-23  9:10     ` Chris Wilson
  0 siblings, 0 replies; 19+ messages in thread
From: Chris Wilson @ 2017-01-23  9:10 UTC (permalink / raw)
  To: Geliang Tang
  Cc: David Airlie, intel-gfx, linux-kernel, dri-devel, Daniel Vetter

On Fri, Jan 20, 2017 at 10:36:55PM +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>

Applied, thanks.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2] dm bio prison: use rb_entry()
  2017-01-20 15:12   ` Coly Li
@ 2017-05-06 15:39     ` Geliang Tang
  0 siblings, 0 replies; 19+ messages in thread
From: Geliang Tang @ 2017-05-06 15:39 UTC (permalink / raw)
  To: Alasdair Kergon, Mike Snitzer, dm-devel, Shaohua Li, Coly Li
  Cc: Geliang Tang, linux-raid, linux-kernel

To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Acked-by: Coly Li <colyli@suse.de>
---
Changes in v2:
 - Apply to dm-bio-prison-v1.c and dm-bio-prison-v2.c
---
 drivers/md/dm-bio-prison-v1.c | 2 +-
 drivers/md/dm-bio-prison-v2.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/md/dm-bio-prison-v1.c b/drivers/md/dm-bio-prison-v1.c
index ae7da2c..f8d221b 100644
--- a/drivers/md/dm-bio-prison-v1.c
+++ b/drivers/md/dm-bio-prison-v1.c
@@ -116,7 +116,7 @@ static int __bio_detain(struct dm_bio_prison *prison,
 
 	while (*new) {
 		struct dm_bio_prison_cell *cell =
-			container_of(*new, struct dm_bio_prison_cell, node);
+			rb_entry(*new, struct dm_bio_prison_cell, node);
 
 		r = cmp_keys(key, &cell->key);
 
diff --git a/drivers/md/dm-bio-prison-v2.c b/drivers/md/dm-bio-prison-v2.c
index c9b11f7..8ce3a1a 100644
--- a/drivers/md/dm-bio-prison-v2.c
+++ b/drivers/md/dm-bio-prison-v2.c
@@ -120,7 +120,7 @@ static bool __find_or_insert(struct dm_bio_prison_v2 *prison,
 
 	while (*new) {
 		struct dm_bio_prison_cell_v2 *cell =
-			container_of(*new, struct dm_bio_prison_cell_v2, node);
+			rb_entry(*new, struct dm_bio_prison_cell_v2, node);
 
 		r = cmp_keys(key, &cell->key);
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2017-05-06 15:39 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-20 14:36 [PATCH] 6lowpan: use rb_entry() Geliang Tang
2017-01-20 14:36 ` [PATCH] dm bio prison: " Geliang Tang
2017-01-20 15:12   ` Coly Li
2017-05-06 15:39     ` [PATCH v2] " Geliang Tang
2017-01-20 14:36 ` [PATCH] drm/i915/error: " Geliang Tang
2017-01-20 14:36   ` Geliang Tang
2017-01-23  9:10   ` [Intel-gfx] " Chris Wilson
2017-01-23  9:10     ` Chris Wilson
2017-01-20 14:36 ` [PATCH] drm/nouveau/client: " Geliang Tang
2017-01-20 14:36   ` Geliang Tang
     [not found]   ` <22da087ad757fafdb206fd0c57d286449302acdb.1484816560.git.geliangtang-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-21  0:14     ` Ben Skeggs
2017-01-20 14:36 ` [PATCH] net/mlx4: " Geliang Tang
2017-01-22  7:48   ` Leon Romanovsky
2017-01-22 14:42     ` Geliang Tang
2017-01-22 19:05       ` Leon Romanovsky
2017-01-22 21:48     ` David Miller
2017-01-22 21:48   ` David Miller
2017-01-20 15:24 ` ✗ Fi.CI.BAT: failure for drm/i915/error: " Patchwork
2017-01-22 21:47 ` [PATCH] 6lowpan: " David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.