Skip to content

Commit

Permalink
6lowpan: use rb_entry()
Browse files Browse the repository at this point in the history
To make the code clearer, use rb_entry() instead of container_of() to
deal with rbtree.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Geliang Tang authored and David S. Miller committed Jan 22, 2017
1 parent 9a549c1 commit 530cef2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions net/6lowpan/nhc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 530cef2

Please sign in to comment.