]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: inline rollback_registered()
authorJakub Kicinski <kuba@kernel.org>
Tue, 19 Jan 2021 20:25:19 +0000 (12:25 -0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 21 Jan 2021 05:04:18 +0000 (21:04 -0800)
rollback_registered() is a local helper, it's common for driver
code to call unregister_netdevice_queue(dev, NULL) when they
want to unregister netdevices under rtnl_lock. Inline
rollback_registered() and adjust the only remaining caller.

Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/dev.c

index 9476edf702646e5bf2dab5bdb8a3669d68bf26d5..9a147142c477abee6a3974125284fbd82a78ad75 100644 (file)
@@ -9552,15 +9552,6 @@ static void rollback_registered_many(struct list_head *head)
        }
 }
 
-static void rollback_registered(struct net_device *dev)
-{
-       LIST_HEAD(single);
-
-       list_add(&dev->unreg_list, &single);
-       rollback_registered_many(&single);
-       list_del(&single);
-}
-
 static netdev_features_t netdev_sync_upper_features(struct net_device *lower,
        struct net_device *upper, netdev_features_t features)
 {
@@ -10110,7 +10101,7 @@ int register_netdevice(struct net_device *dev)
        if (ret) {
                /* Expect explicit free_netdev() on failure */
                dev->needs_free_netdev = false;
-               rollback_registered(dev);
+               unregister_netdevice_queue(dev, NULL);
                goto out;
        }
        /*
@@ -10732,7 +10723,11 @@ void unregister_netdevice_queue(struct net_device *dev, struct list_head *head)
        if (head) {
                list_move_tail(&dev->unreg_list, head);
        } else {
-               rollback_registered(dev);
+               LIST_HEAD(single);
+
+               list_add(&dev->unreg_list, &single);
+               rollback_registered_many(&single);
+               list_del(&single);
        }
 }
 EXPORT_SYMBOL(unregister_netdevice_queue);