Commit 30fdd8a0 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

netpoll: move np->dev and np->dev_name init into __netpoll_setup()

Signed-off-by: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0c24604b
...@@ -1240,9 +1240,7 @@ static inline int slave_enable_netpoll(struct slave *slave) ...@@ -1240,9 +1240,7 @@ static inline int slave_enable_netpoll(struct slave *slave)
if (!np) if (!np)
goto out; goto out;
np->dev = slave->dev; err = __netpoll_setup(np, slave->dev);
strlcpy(np->dev_name, slave->dev->name, IFNAMSIZ);
err = __netpoll_setup(np);
if (err) { if (err) {
kfree(np); kfree(np);
goto out; goto out;
......
...@@ -43,7 +43,7 @@ struct netpoll_info { ...@@ -43,7 +43,7 @@ struct netpoll_info {
void netpoll_send_udp(struct netpoll *np, const char *msg, int len); void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
void netpoll_print_options(struct netpoll *np); void netpoll_print_options(struct netpoll *np);
int netpoll_parse_options(struct netpoll *np, char *opt); int netpoll_parse_options(struct netpoll *np, char *opt);
int __netpoll_setup(struct netpoll *np); int __netpoll_setup(struct netpoll *np, struct net_device *ndev);
int netpoll_setup(struct netpoll *np); int netpoll_setup(struct netpoll *np);
int netpoll_trap(void); int netpoll_trap(void);
void netpoll_set_trap(int trap); void netpoll_set_trap(int trap);
......
...@@ -681,10 +681,7 @@ static int vlan_dev_netpoll_setup(struct net_device *dev, struct netpoll_info *n ...@@ -681,10 +681,7 @@ static int vlan_dev_netpoll_setup(struct net_device *dev, struct netpoll_info *n
if (!netpoll) if (!netpoll)
goto out; goto out;
netpoll->dev = real_dev; err = __netpoll_setup(netpoll, real_dev);
strlcpy(netpoll->dev_name, real_dev->name, IFNAMSIZ);
err = __netpoll_setup(netpoll);
if (err) { if (err) {
kfree(netpoll); kfree(netpoll);
goto out; goto out;
......
...@@ -246,10 +246,7 @@ int br_netpoll_enable(struct net_bridge_port *p) ...@@ -246,10 +246,7 @@ int br_netpoll_enable(struct net_bridge_port *p)
if (!np) if (!np)
goto out; goto out;
np->dev = p->dev; err = __netpoll_setup(np, p->dev);
strlcpy(np->dev_name, p->dev->name, IFNAMSIZ);
err = __netpoll_setup(np);
if (err) { if (err) {
kfree(np); kfree(np);
goto out; goto out;
......
...@@ -715,14 +715,16 @@ int netpoll_parse_options(struct netpoll *np, char *opt) ...@@ -715,14 +715,16 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
} }
EXPORT_SYMBOL(netpoll_parse_options); EXPORT_SYMBOL(netpoll_parse_options);
int __netpoll_setup(struct netpoll *np) int __netpoll_setup(struct netpoll *np, struct net_device *ndev)
{ {
struct net_device *ndev = np->dev;
struct netpoll_info *npinfo; struct netpoll_info *npinfo;
const struct net_device_ops *ops; const struct net_device_ops *ops;
unsigned long flags; unsigned long flags;
int err; int err;
np->dev = ndev;
strlcpy(np->dev_name, ndev->name, IFNAMSIZ);
if ((ndev->priv_flags & IFF_DISABLE_NETPOLL) || if ((ndev->priv_flags & IFF_DISABLE_NETPOLL) ||
!ndev->netdev_ops->ndo_poll_controller) { !ndev->netdev_ops->ndo_poll_controller) {
np_err(np, "%s doesn't support polling, aborting\n", np_err(np, "%s doesn't support polling, aborting\n",
...@@ -851,13 +853,11 @@ int netpoll_setup(struct netpoll *np) ...@@ -851,13 +853,11 @@ int netpoll_setup(struct netpoll *np)
np_info(np, "local IP %pI4\n", &np->local_ip); np_info(np, "local IP %pI4\n", &np->local_ip);
} }
np->dev = ndev;
/* fill up the skb queue */ /* fill up the skb queue */
refill_skbs(); refill_skbs();
rtnl_lock(); rtnl_lock();
err = __netpoll_setup(np); err = __netpoll_setup(np, ndev);
rtnl_unlock(); rtnl_unlock();
if (err) if (err)
......
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