Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754475AbbLRPgE (ORCPT ); Fri, 18 Dec 2015 10:36:04 -0500 Received: from m50-132.163.com ([123.125.50.132]:57484 "EHLO m50-132.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754400AbbLRPef (ORCPT ); Fri, 18 Dec 2015 10:34:35 -0500 From: Geliang Tang To: "David S. Miller" , Florian Fainelli , Neil Armstrong Cc: Geliang Tang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/14] net: dsa: use list_for_each_entry Date: Fri, 18 Dec 2015 23:33:33 +0800 Message-Id: X-Mailer: git-send-email 2.5.0 In-Reply-To: References: In-Reply-To: References: X-CM-TRANSID: DNGowEDJIUtnJ3RW_4aGAA--.687S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7GF4rGr15tFWUJF1xCrykZrb_yoWDXFc_ur yxXF4kWr4UGrsakay0gw4fZr9rAFWxArsagr4IyFW5Gw43ur15tF1jyF13Jryxur1xCr95 u3ZxJrWfuw1UXjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUj9a9DUUUUU== X-Originating-IP: [116.77.150.30] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/1tbiGQnUmVXlQAJgswAAs8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1215 Lines: 43 Use list_for_each_entry() instead of list_for_each() to simplify the code. Signed-off-by: Geliang Tang --- net/dsa/dsa.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 208d1b2..2ab4a19 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c @@ -53,19 +53,14 @@ EXPORT_SYMBOL_GPL(unregister_switch_driver); static struct dsa_switch_driver * dsa_switch_probe(struct device *host_dev, int sw_addr, char **_name) { - struct dsa_switch_driver *ret; - struct list_head *list; + struct dsa_switch_driver *ret, *drv; char *name; ret = NULL; name = NULL; mutex_lock(&dsa_switch_drivers_mutex); - list_for_each(list, &dsa_switch_drivers) { - struct dsa_switch_driver *drv; - - drv = list_entry(list, struct dsa_switch_driver, list); - + list_for_each_entry(drv, &dsa_switch_drivers, list) { name = drv->probe(host_dev, sw_addr); if (name != NULL) { ret = drv; -- 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/