Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1294965 > unrolled thread

[PATCH 09/14] net: dsa: use list_for_each_entry

Started byGeliang Tang <geliangtang@163.com>
First post2015-12-18 16:40 +0100
Last post2015-12-18 16:40 +0100
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 09/14] net: dsa: use list_for_each_entry Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100

#1294965 — [PATCH 09/14] net: dsa: use list_for_each_entry

FromGeliang Tang <geliangtang@163.com>
Date2015-12-18 16:40 +0100
Subject[PATCH 09/14] net: dsa: use list_for_each_entry
Message-ID<qH5ip-7rE-15@gated-at.bofh.it>
Use list_for_each_entry() instead of list_for_each() to simplify
the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 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/

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web