]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: call call_netdevice_unregister_net_notifiers from unregister
authorJiri Pirko <jiri@mellanox.com>
Sat, 25 Jan 2020 11:17:06 +0000 (12:17 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Jan 2020 10:03:44 +0000 (11:03 +0100)
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>
net/core/dev.c

index ce8900dbd9ead9e53a4ad618209c5f13ec26d1ac..ee4b1e64d66334e78f9ca8652a5188d82e3d1853 100644 (file)
@@ -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;
        int err;
 
        struct net *net;
        int err;
 
@@ -1775,16 +1774,9 @@ int unregister_netdevice_notifier(struct notifier_block *nb)
        if (err)
                goto unlock;
 
        if (err)
                goto unlock;
 
-       for_each_net(net) {
-               for_each_netdev(net, dev) {
-                       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);
-               }
-       }
+       for_each_net(net)
+               call_netdevice_unregister_net_notifiers(nb, net);
+
 unlock:
        rtnl_unlock();
        up_write(&pernet_ops_rwsem);
 unlock:
        rtnl_unlock();
        up_write(&pernet_ops_rwsem);