[NET]: Introduce dev_getbyfirsthwtype.

parent 217e86f8
......@@ -498,6 +498,8 @@ extern void probe_old_netdevs(void);
extern int netdev_boot_setup_add(char *name, struct ifmap *map);
extern int netdev_boot_setup_check(struct net_device *dev);
extern struct net_device *dev_getbyhwaddr(unsigned short type, char *hwaddr);
extern struct net_device *__dev_getfirstbyhwtype(unsigned short type);
extern struct net_device *dev_getfirstbyhwtype(unsigned short type);
extern void dev_add_pack(struct packet_type *pt);
extern void dev_remove_pack(struct packet_type *pt);
extern void __dev_remove_pack(struct packet_type *pt);
......
......@@ -550,6 +550,32 @@ struct net_device *dev_getbyhwaddr(unsigned short type, char *ha)
return dev;
}
struct net_device *__dev_getfirstbyhwtype(unsigned short type)
{
struct net_device *dev;
for (dev = dev_base; dev; dev = dev->next)
if (dev->type == type)
break;
return dev;
}
EXPORT_SYMBOL(__dev_getfirstbyhwtype);
struct net_device *dev_getfirstbyhwtype(unsigned short type)
{
struct net_device *dev;
rtnl_lock();
dev = __dev_getfirstbyhwtype(type);
if (dev)
dev_hold(dev);
rtnl_unlock();
return dev;
}
EXPORT_SYMBOL(dev_getfirstbyhwtype);
/**
* dev_get_by_flags - find any device with given flags
* @if_flags: IFF_* values
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment