From patchwork Fri Jan 20 14:36:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 9528659 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1148B60459 for ; Fri, 20 Jan 2017 14:41:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0476B28135 for ; Fri, 20 Jan 2017 14:41:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ECF5F2868D; Fri, 20 Jan 2017 14:41:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABC0528135 for ; Fri, 20 Jan 2017 14:41:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752282AbdATOkr (ORCPT ); Fri, 20 Jan 2017 09:40:47 -0500 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35598 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752420AbdATOkp (ORCPT ); Fri, 20 Jan 2017 09:40:45 -0500 Received: by mail-pf0-f195.google.com with SMTP id f144so5600946pfa.2; Fri, 20 Jan 2017 06:37:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=lcB2kna8lyxzXObnT3b6na2LlyoF3jgIJN7azYnkyVE=; b=CE8yckMPeNAgnHKegyiMhmK38/ygFtZwtDbb9ugl0/M4VkEPi4J3ek5j1uz9pe3oUs A3l2NFkixfN/ZhiwEK/mUNqtVh7IaN/URZt01ZqH7ihVqdJ9ZZba7dc28RKN1mF4/TRN S6zA+GIwgzPse0+HOYXsaJzLk3SiAF/8sEGIhdyArCGDv7TcJD8MHAtSwPx/7osP6jpP rquRNeYnJWxIM4RPKOMAyuQZG44x572Ke1CvdmeopTbhRmL1uOf1h1/wFn+6WbPo8/kP CnKfYhwOfNlCER9guKz/zMd/lnLEVeaHxL+uq4tVw2h+h5nnLIo55iKF6jH8Y1A/UgHk SqnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=lcB2kna8lyxzXObnT3b6na2LlyoF3jgIJN7azYnkyVE=; b=AfuAmfNas6ClbaK/27RKXM7Gpn3xY5Vp0L9x6OXEgiLlfF3Pp6/W8xt4eom622Fv0K C4BY5/GGxelxvrhyV8e15pLklRdovnMgveyTI4lkI68oTWjAAmxsN9YTUvCI5MfEM6+F cCGytBWj0FnMi+I2uUrdkWkw15zXjTXREhkoTz0uZGAXGY5N0DXaMW1Wuaz1j73DBibm v9fKnKTiBDiaEM/siGdBYb6EEUW4V7NSe/sme0RC4XvmLDOI+1YLD2oQLhogr5Q0XMpi FnY3lT+sT6OzbGbK1d73vaedIpAbXVokXgZMXEvqBESSH0ciCEVfPiCmi0KbKrz7ucvo N0uw== X-Gm-Message-State: AIkVDXJc6fFzg1BHFFljDgC55XlpDR2jLh5R2shUwdDpb/3Bn5gbojIQOBBBZWE25HAXYw== X-Received: by 10.98.163.23 with SMTP id s23mr16888866pfe.60.1484923023956; Fri, 20 Jan 2017 06:37:03 -0800 (PST) Received: from localhost ([162.211.125.117]) by smtp.gmail.com with ESMTPSA id q19sm17482229pfl.21.2017.01.20.06.37.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Jan 2017 06:37:03 -0800 (PST) From: Geliang Tang To: Alexander Aring , Jukka Rissanen , "David S. Miller" Cc: Geliang Tang , linux-bluetooth@vger.kernel.org, linux-wpan@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] 6lowpan: use rb_entry() Date: Fri, 20 Jan 2017 22:36:53 +0800 Message-Id: X-Mailer: git-send-email 2.9.3 Sender: linux-wpan-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wpan@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To make the code clearer, use rb_entry() instead of container_of() to deal with rbtree. Signed-off-by: Geliang Tang --- 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;