Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1294965
| From | Geliang Tang <geliangtang@163.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 09/14] net: dsa: use list_for_each_entry |
| Date | 2015-12-18 16:40 +0100 |
| Message-ID | <qH5ip-7rE-15@gated-at.bofh.it> (permalink) |
| References | <qH5ip-7rE-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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/
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH 09/14] net: dsa: use list_for_each_entry Geliang Tang <geliangtang@163.com> - 2015-12-18 16:40 +0100
csiph-web