Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932766AbbLRPey (ORCPT ); Fri, 18 Dec 2015 10:34:54 -0500 Received: from m50-138.163.com ([123.125.50.138]:38025 "EHLO m50-138.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932586AbbLRPei (ORCPT ); Fri, 18 Dec 2015 10:34:38 -0500 From: Geliang Tang To: Pravin Shelar , "David S. Miller" Cc: Geliang Tang , netdev@vger.kernel.org, dev@openvswitch.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/14] openvswitch: use list_for_each_entry Date: Fri, 18 Dec 2015 23:33:35 +0800 Message-Id: <13c7141db917b9fb45dfec05da494318bd7d0ff9.1450451516.git.geliangtang@163.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: References: In-Reply-To: References: X-CM-TRANSID: C9GowAAnIxBrJ3RWmD+mAA--.30826S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7GF45GF1DJw17ZFWrKrWUXFb_yoWfArc_u3 yxt3Z5Gr43tryrKrW7Kws3Xr93Gw15WryxZrs7tFWDXryDWa1Fkry0gF93Ary5uF10qFyr XwnxAry3GF43XjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUj9mR5UUUUU== X-Originating-IP: [116.77.150.30] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbiGQzUmVXlQAJg2AAAsS Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1111 Lines: 35 Use list_for_each_entry() instead of list_for_each() to simplify the code. Signed-off-by: Geliang Tang --- net/openvswitch/flow_table.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/net/openvswitch/flow_table.c b/net/openvswitch/flow_table.c index d073fff..9b5999ba 100644 --- a/net/openvswitch/flow_table.c +++ b/net/openvswitch/flow_table.c @@ -651,11 +651,9 @@ static bool mask_equal(const struct sw_flow_mask *a, static struct sw_flow_mask *flow_mask_find(const struct flow_table *tbl, const struct sw_flow_mask *mask) { - struct list_head *ml; + struct sw_flow_mask *m; - list_for_each(ml, &tbl->mask_list) { - struct sw_flow_mask *m; - m = container_of(ml, struct sw_flow_mask, list); + list_for_each_entry(m, &tbl->mask_list, list) { if (mask_equal(mask, m)) return m; } -- 2.5.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/