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

From: Geliang Tang
Date: Fri Dec 18 2015 - 10:36:34 EST


Use list_for_each_entry() instead of list_for_each() to simplify
the code.

Signed-off-by: Geliang Tang <geliangtang@xxxxxxx>
---
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/