提交 9e56986a 编写于 作者: A Andy Fleming

Add eth_get_dev_by_index

This allows code to iterate through the ethernet devices
Signed-off-by: NAndy Fleming <afleming@freescale.com>
上级 b6730512
......@@ -80,6 +80,28 @@ struct eth_device *eth_get_dev_by_name(char *devname)
return target_dev;
}
struct eth_device *eth_get_dev_by_index(int index)
{
struct eth_device *dev, *target_dev;
int idx = 0;
if (!eth_devices)
return NULL;
dev = eth_devices;
target_dev = NULL;
do {
if (idx == index) {
target_dev = dev;
break;
}
dev = dev->next;
idx++;
} while (dev != eth_devices);
return target_dev;
}
int eth_get_dev_index (void)
{
struct eth_device *dev;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册