Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754539AbbLRPgG (ORCPT ); Fri, 18 Dec 2015 10:36:06 -0500 Received: from m50-133.163.com ([123.125.50.133]:52688 "EHLO m50-133.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754395AbbLRPee (ORCPT ); Fri, 18 Dec 2015 10:34:34 -0500 From: Geliang Tang To: Jamal Hadi Salim , "David S. Miller" Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/14] net: sched: use list_for_each_entry Date: Fri, 18 Dec 2015 23:33:36 +0800 Message-Id: <7af1edfe42223ba907e54f69c68ca552f84f3bf1.1450451516.git.geliangtang@163.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: References: In-Reply-To: References: X-CM-TRANSID: DdGowECJzlRsJ3RWa+2HAA--.939S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7GF47Xry3XrW7WFW5ZFy3twb_yoWfGFc_Z3 9FyF1kGF4rGF4rX3yjkrs7Cr97AF1rKw1fJrZFyFW7J3s5K398KrykJ3W8XryxWrWxKF98 XFnFqFy5G342kjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUU_cTtUUUUU== X-Originating-IP: [116.77.150.30] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbiJQ7UmVUL85KrYwAAsR Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1106 Lines: 35 Use list_for_each_entry() instead of list_for_each() to simplify the code. Signed-off-by: Geliang Tang --- net/sched/sch_htb.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 15ccd7f..5f7aa74 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c @@ -948,10 +948,9 @@ static unsigned int htb_drop(struct Qdisc *sch) int prio; for (prio = TC_HTB_NUMPRIO - 1; prio >= 0; prio--) { - struct list_head *p; - list_for_each(p, q->drops + prio) { - struct htb_class *cl = list_entry(p, struct htb_class, - un.leaf.drop_list); + struct htb_class *cl; + + list_for_each_entry(cl, q->drops + prio, un.leaf.drop_list) { unsigned int len; if (cl->un.leaf.q->ops->drop && (len = cl->un.leaf.q->ops->drop(cl->un.leaf.q))) { -- 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/