diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2009-10-30 04:40:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-30 04:40:11 -0400 |
commit | 0bd8d53656da72bc065766b5f2a05ca738020b8a (patch) | |
tree | e02e9b68286d9e8b57fce6b9f2ed8a89baae25ba /net | |
parent | 24540535d33f72505807be3e7ef2e94f3726f971 (diff) |
net: use hlist_for_each_entry()
Small cleanup of __dev_get_by_name() and __dev_get_by_index()
to use hlist_for_each_entry() : They'll look like their _rcu variant.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/core/dev.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/net/core/dev.c b/net/core/dev.c index 631cc40da197..94f42a15fff1 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -587,13 +587,13 @@ __setup("netdev=", netdev_boot_setup); | |||
587 | struct net_device *__dev_get_by_name(struct net *net, const char *name) | 587 | struct net_device *__dev_get_by_name(struct net *net, const char *name) |
588 | { | 588 | { |
589 | struct hlist_node *p; | 589 | struct hlist_node *p; |
590 | struct net_device *dev; | ||
591 | struct hlist_head *head = dev_name_hash(net, name); | ||
590 | 592 | ||
591 | hlist_for_each(p, dev_name_hash(net, name)) { | 593 | hlist_for_each_entry(dev, p, head, name_hlist) |
592 | struct net_device *dev | ||
593 | = hlist_entry(p, struct net_device, name_hlist); | ||
594 | if (!strncmp(dev->name, name, IFNAMSIZ)) | 594 | if (!strncmp(dev->name, name, IFNAMSIZ)) |
595 | return dev; | 595 | return dev; |
596 | } | 596 | |
597 | return NULL; | 597 | return NULL; |
598 | } | 598 | } |
599 | EXPORT_SYMBOL(__dev_get_by_name); | 599 | EXPORT_SYMBOL(__dev_get_by_name); |
@@ -638,13 +638,13 @@ EXPORT_SYMBOL(dev_get_by_name); | |||
638 | struct net_device *__dev_get_by_index(struct net *net, int ifindex) | 638 | struct net_device *__dev_get_by_index(struct net *net, int ifindex) |
639 | { | 639 | { |
640 | struct hlist_node *p; | 640 | struct hlist_node *p; |
641 | struct net_device *dev; | ||
642 | struct hlist_head *head = dev_index_hash(net, ifindex); | ||
641 | 643 | ||
642 | hlist_for_each(p, dev_index_hash(net, ifindex)) { | 644 | hlist_for_each_entry(dev, p, head, index_hlist) |
643 | struct net_device *dev | ||
644 | = hlist_entry(p, struct net_device, index_hlist); | ||
645 | if (dev->ifindex == ifindex) | 645 | if (dev->ifindex == ifindex) |
646 | return dev; | 646 | return dev; |
647 | } | 647 | |
648 | return NULL; | 648 | return NULL; |
649 | } | 649 | } |
650 | EXPORT_SYMBOL(__dev_get_by_index); | 650 | EXPORT_SYMBOL(__dev_get_by_index); |