summaryrefslogtreecommitdiffstats
path: root/net/eth.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-02-03 13:14:38 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2016-07-14 22:24:19 +0200
commit8b3244d3a8e06d743c58324ab407e3746c4e1e84 (patch)
treeee2fa2c1d524b12c31c989f473d437ec4ca201f6 /net/eth.c
parent048864571f4816f34259519b31033c3986cb2e88 (diff)
downloadbarebox-8b3244d3a8e06d743c58324ab407e3746c4e1e84.tar.gz
barebox-8b3244d3a8e06d743c58324ab407e3746c4e1e84.tar.xz
net: introduce for_each_netdev iterator
for_each_netdev is nicer to read. Also export the list of network devices since it will be used by code outside of net/eth.c in later patches. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'net/eth.c')
-rw-r--r--net/eth.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/net/eth.c b/net/eth.c
index 6bec154f36..499f4b04da 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -31,7 +31,7 @@
static struct eth_device *eth_current;
static uint64_t last_link_check;
-static LIST_HEAD(netdev_list);
+LIST_HEAD(netdev_list);
struct eth_ethaddr {
struct list_head list;
@@ -104,7 +104,7 @@ void eth_register_ethaddr(int ethid, const char *ethaddr)
eth_drop_ethaddr(ethid);
- list_for_each_entry(edev, &netdev_list, list) {
+ for_each_netdev(edev) {
if (edev->dev.id == ethid) {
register_preset_mac_address(edev, ethaddr);
return;
@@ -121,7 +121,7 @@ static struct eth_device *eth_get_by_node(struct device_node *node)
{
struct eth_device *edev;
- list_for_each_entry(edev, &netdev_list, list) {
+ for_each_netdev(edev) {
if (!edev->parent)
continue;
if (!edev->parent->device_node)
@@ -163,7 +163,7 @@ struct eth_device *eth_get_byname(const char *ethname)
{
struct eth_device *edev;
- list_for_each_entry(edev, &netdev_list, list) {
+ for_each_netdev(edev) {
if (!strcmp(ethname, dev_name(&edev->dev)))
return edev;
}
@@ -179,7 +179,7 @@ int eth_complete(struct string_list *sl, char *instr)
len = strlen(instr);
- list_for_each_entry(edev, &netdev_list, list) {
+ for_each_netdev(edev) {
devname = dev_name(&edev->dev);
if (strncmp(instr, devname, len))
continue;
@@ -273,7 +273,7 @@ int eth_rx(void)
{
struct eth_device *edev;
- list_for_each_entry(edev, &netdev_list, list) {
+ for_each_netdev(edev) {
if (edev->active)
__eth_rx(edev);
}
@@ -337,7 +337,7 @@ static int eth_of_fixup(struct device_node *root, void *unused)
eth_of_fixup_node(root, addr->node ? addr->node->full_name : NULL,
addr->ethid, addr->ethaddr);
- list_for_each_entry(edev, &netdev_list, list)
+ for_each_netdev(edev)
eth_of_fixup_node(root, edev->nodepath, edev->dev.id, edev->ethaddr);
return 0;