]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
net: netpoll: extract core of netpoll_cleanup
authorBreno Leitao <leitao@debian.org>
Thu, 8 Aug 2024 12:25:07 +0000 (05:25 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 13 Aug 2024 08:58:58 +0000 (10:58 +0200)
Extract the core part of netpoll_cleanup(), so, it could be called from
a caller that has the rtnl lock already.

Netconsole uses this in a weird way right now:

__netpoll_cleanup(&nt->np);
spin_lock_irqsave(&target_list_lock, flags);
netdev_put(nt->np.dev, &nt->np.dev_tracker);
nt->np.dev = NULL;
nt->enabled = false;

This will be replaced by do_netpoll_cleanup() as the locking situation
is overhauled.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Rik van Riel <riel@surriel.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
include/linux/netpoll.h
net/core/netpoll.c

index bd19c4b91e31204e85d30884720b761116d5c036..cd4e28db0cbd77572a579aff2067b5864d1a904a 100644 (file)
@@ -64,6 +64,7 @@ int netpoll_setup(struct netpoll *np);
 void __netpoll_cleanup(struct netpoll *np);
 void __netpoll_free(struct netpoll *np);
 void netpoll_cleanup(struct netpoll *np);
+void do_netpoll_cleanup(struct netpoll *np);
 netdev_tx_t netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
 
 #ifdef CONFIG_NETPOLL
index 55bcacf67df3b672280c905c3572cd86d773fa3d..a58ea724790ce772004f4053afab0f7da458aff1 100644 (file)
@@ -853,14 +853,20 @@ void __netpoll_free(struct netpoll *np)
 }
 EXPORT_SYMBOL_GPL(__netpoll_free);
 
+void do_netpoll_cleanup(struct netpoll *np)
+{
+       __netpoll_cleanup(np);
+       netdev_put(np->dev, &np->dev_tracker);
+       np->dev = NULL;
+}
+EXPORT_SYMBOL(do_netpoll_cleanup);
+
 void netpoll_cleanup(struct netpoll *np)
 {
        rtnl_lock();
        if (!np->dev)
                goto out;
-       __netpoll_cleanup(np);
-       netdev_put(np->dev, &np->dev_tracker);
-       np->dev = NULL;
+       do_netpoll_cleanup(np);
 out:
        rtnl_unlock();
 }