netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 6lowpan: use rb_entry()
@ 2017-01-20 14:36 Geliang Tang
  2017-01-20 14:36 ` [PATCH] net/mlx4: " Geliang Tang
  2017-01-22 21:47 ` [PATCH] 6lowpan: " David Miller
  0 siblings, 2 replies; 8+ 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] 8+ messages in thread

end of thread, other threads:[~2017-01-22 21:48 UTC | newest]

Thread overview: 8+ 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] 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-22 21:47 ` [PATCH] 6lowpan: " David Miller

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).