]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
6lowpan: use rb_entry()
authorGeliang Tang <geliangtang@gmail.com>
Fri, 20 Jan 2017 14:36:53 +0000 (22:36 +0800)
committerDavid S. Miller <davem@davemloft.net>
Sun, 22 Jan 2017 21:46:13 +0000 (16:46 -0500)
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>
net/6lowpan/nhc.c

index 7008d53e455c5254db5879bb044b0a4b6d706775..4fa2fdda174d0139e669bd282ab4362aea41f512 100644 (file)
@@ -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;