[RTNETLINK]: rtnl_link API simplification

All drivers need to unregister their devices in the module unload function.
While doing so they must hold the rtnl and atomically unregister the
rtnl_link ops as well. This makes the rtnl_link_unregister function that
takes the rtnl itself completely useless.

Provide default newlink/dellink functions, make __rtnl_link_unregister and
rtnl_link_unregister unregister all devices with matching rtnl_link_ops and
change the existing users to take advantage of that.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Patrick McHardy 2007-07-11 19:42:13 -07:00 committed by David S. Miller
parent 8c979c26a0
commit 2d85cba2b2
4 changed files with 23 additions and 131 deletions

View file

@ -115,26 +115,6 @@ err1:
return err;
}
/* Cleanup all vlan devices
* Note: devices that have been registered that but not
* brought up will exist but have no module ref count.
*/
static void __exit vlan_cleanup_devices(void)
{
struct net_device *dev, *nxt;
rtnl_lock();
for_each_netdev_safe(dev, nxt) {
if (dev->priv_flags & IFF_802_1Q_VLAN) {
unregister_vlan_dev(VLAN_DEV_INFO(dev)->real_dev,
VLAN_DEV_INFO(dev)->vlan_id);
unregister_netdevice(dev);
}
}
rtnl_unlock();
}
/*
* Module 'remove' entry point.
* o delete /proc/net/router directory and static entries.
@ -150,7 +130,6 @@ static void __exit vlan_cleanup_module(void)
unregister_netdevice_notifier(&vlan_notifier_block);
dev_remove_pack(&vlan_packet_type);
vlan_cleanup_devices();
/* This table must be empty if there are no module
* references left.