net: call call_netdevice_unregister_net_notifiers from unregister
The function does the same thing as the existing code, so rather call call_netdevice_unregister_net_notifiers() instead of code duplication. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
cd94ef0639
commit
48b3a1379f
@@ -1764,7 +1764,6 @@ EXPORT_SYMBOL(register_netdevice_notifier);
|
|||||||
|
|
||||||
int unregister_netdevice_notifier(struct notifier_block *nb)
|
int unregister_netdevice_notifier(struct notifier_block *nb)
|
||||||
{
|
{
|
||||||
struct net_device *dev;
|
|
||||||
struct net *net;
|
struct net *net;
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
@@ -1775,16 +1774,9 @@ int unregister_netdevice_notifier(struct notifier_block *nb)
|
|||||||
if (err)
|
if (err)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
||||||
for_each_net(net) {
|
for_each_net(net)
|
||||||
for_each_netdev(net, dev) {
|
call_netdevice_unregister_net_notifiers(nb, net);
|
||||||
if (dev->flags & IFF_UP) {
|
|
||||||
call_netdevice_notifier(nb, NETDEV_GOING_DOWN,
|
|
||||||
dev);
|
|
||||||
call_netdevice_notifier(nb, NETDEV_DOWN, dev);
|
|
||||||
}
|
|
||||||
call_netdevice_notifier(nb, NETDEV_UNREGISTER, dev);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
unlock:
|
unlock:
|
||||||
rtnl_unlock();
|
rtnl_unlock();
|
||||||
up_write(&pernet_ops_rwsem);
|
up_write(&pernet_ops_rwsem);
|
||||||
|
Reference in New Issue
Block a user