Commit 1ef33652 authored by Breno Leitao's avatar Breno Leitao Committed by Paolo Abeni

net: netpoll: extract core of netpoll_cleanup

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: default avatarBreno Leitao <leitao@debian.org>
Reviewed-by: default avatarRik van Riel <riel@surriel.com>
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
parent 2bbf1aed
...@@ -64,6 +64,7 @@ int netpoll_setup(struct netpoll *np); ...@@ -64,6 +64,7 @@ int netpoll_setup(struct netpoll *np);
void __netpoll_cleanup(struct netpoll *np); void __netpoll_cleanup(struct netpoll *np);
void __netpoll_free(struct netpoll *np); void __netpoll_free(struct netpoll *np);
void netpoll_cleanup(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); netdev_tx_t netpoll_send_skb(struct netpoll *np, struct sk_buff *skb);
#ifdef CONFIG_NETPOLL #ifdef CONFIG_NETPOLL
......
...@@ -853,14 +853,20 @@ void __netpoll_free(struct netpoll *np) ...@@ -853,14 +853,20 @@ void __netpoll_free(struct netpoll *np)
} }
EXPORT_SYMBOL_GPL(__netpoll_free); 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) void netpoll_cleanup(struct netpoll *np)
{ {
rtnl_lock(); rtnl_lock();
if (!np->dev) if (!np->dev)
goto out; goto out;
__netpoll_cleanup(np); do_netpoll_cleanup(np);
netdev_put(np->dev, &np->dev_tracker);
np->dev = NULL;
out: out:
rtnl_unlock(); rtnl_unlock();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment