netpoll: move np->dev and np->dev_name init into __netpoll_setup()
authorJiri Pirko <jiri@resnulli.us>
Tue, 17 Jul 2012 05:22:35 +0000 (05:22 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 Jul 2012 16:02:36 +0000 (09:02 -0700)
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/bonding/bond_main.c
include/linux/netpoll.h
net/8021q/vlan_dev.c
net/bridge/br_device.c
net/core/netpoll.c

index 4ddcc3e41dabe5059a9981467f2c2bca2d7c5828..1eb3979d0af583a9cc14ba61e6e8507220dd8c07 100644 (file)
@@ -1240,9 +1240,7 @@ static inline int slave_enable_netpoll(struct slave *slave)
        if (!np)
                goto out;
 
-       np->dev = slave->dev;
-       strlcpy(np->dev_name, slave->dev->name, IFNAMSIZ);
-       err = __netpoll_setup(np);
+       err = __netpoll_setup(np, slave->dev);
        if (err) {
                kfree(np);
                goto out;
index 5dfa091c33478a0798369b8a911015b0e7c076bb..28f5389c924b51b76cf88dc5da1af7f3a0853138 100644 (file)
@@ -43,7 +43,7 @@ struct netpoll_info {
 void netpoll_send_udp(struct netpoll *np, const char *msg, int len);
 void netpoll_print_options(struct netpoll *np);
 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_trap(void);
 void netpoll_set_trap(int trap);
index da1bc9c3cf38bfa36747a22e94898b047a0fdd59..73a2a83ee2da51333731c4bb5f8307a78c2c5496 100644 (file)
@@ -681,10 +681,7 @@ static int vlan_dev_netpoll_setup(struct net_device *dev, struct netpoll_info *n
        if (!netpoll)
                goto out;
 
-       netpoll->dev = real_dev;
-       strlcpy(netpoll->dev_name, real_dev->name, IFNAMSIZ);
-
-       err = __netpoll_setup(netpoll);
+       err = __netpoll_setup(netpoll, real_dev);
        if (err) {
                kfree(netpoll);
                goto out;
index 929e48aed44438bf82565ade96713c0169f5e440..f4be1bbfef26cbfd0e36d83c141e0819752d70cb 100644 (file)
@@ -246,10 +246,7 @@ int br_netpoll_enable(struct net_bridge_port *p)
        if (!np)
                goto out;
 
-       np->dev = p->dev;
-       strlcpy(np->dev_name, p->dev->name, IFNAMSIZ);
-
-       err = __netpoll_setup(np);
+       err = __netpoll_setup(np, p->dev);
        if (err) {
                kfree(np);
                goto out;
index f9f40b932e4b855fc1a4dc3b3c74620efdc4f970..b4c90e42b4434455c8205f4483991326a85eedb6 100644 (file)
@@ -715,14 +715,16 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
 }
 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;
        const struct net_device_ops *ops;
        unsigned long flags;
        int err;
 
+       np->dev = ndev;
+       strlcpy(np->dev_name, ndev->name, IFNAMSIZ);
+
        if ((ndev->priv_flags & IFF_DISABLE_NETPOLL) ||
            !ndev->netdev_ops->ndo_poll_controller) {
                np_err(np, "%s doesn't support polling, aborting\n",
@@ -851,13 +853,11 @@ int netpoll_setup(struct netpoll *np)
                np_info(np, "local IP %pI4\n", &np->local_ip);
        }
 
-       np->dev = ndev;
-
        /* fill up the skb queue */
        refill_skbs();
 
        rtnl_lock();
-       err = __netpoll_setup(np);
+       err = __netpoll_setup(np, ndev);
        rtnl_unlock();
 
        if (err)