diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2010-06-10 12:12:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-15 13:58:39 -0400 |
commit | 4247e161b12f8dffb7ee3ee07bc5e61f714ebe2d (patch) | |
tree | 95edfebfb67abcfb95b1865ce8d78e44c1c153c5 /net/core/netpoll.c | |
parent | dbaa154178341689faaa08fbf40b94ae5ca1d6c0 (diff) |
netpoll: Add ndo_netpoll_setup
This patch adds ndo_netpoll_setup as the initialisation primitive
to complement ndo_netpoll_cleanup.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/netpoll.c')
-rw-r--r-- | net/core/netpoll.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/net/core/netpoll.c b/net/core/netpoll.c index d10c249bcc8f..7de6dcad5d79 100644 --- a/net/core/netpoll.c +++ b/net/core/netpoll.c | |||
@@ -698,6 +698,7 @@ int netpoll_setup(struct netpoll *np) | |||
698 | struct net_device *ndev = NULL; | 698 | struct net_device *ndev = NULL; |
699 | struct in_device *in_dev; | 699 | struct in_device *in_dev; |
700 | struct netpoll_info *npinfo; | 700 | struct netpoll_info *npinfo; |
701 | const struct net_device_ops *ops; | ||
701 | unsigned long flags; | 702 | unsigned long flags; |
702 | int err; | 703 | int err; |
703 | 704 | ||
@@ -797,6 +798,13 @@ int netpoll_setup(struct netpoll *np) | |||
797 | INIT_DELAYED_WORK(&npinfo->tx_work, queue_process); | 798 | INIT_DELAYED_WORK(&npinfo->tx_work, queue_process); |
798 | 799 | ||
799 | atomic_set(&npinfo->refcnt, 1); | 800 | atomic_set(&npinfo->refcnt, 1); |
801 | |||
802 | ops = np->dev->netdev_ops; | ||
803 | if (ops->ndo_netpoll_setup) { | ||
804 | err = ops->ndo_netpoll_setup(ndev, npinfo); | ||
805 | if (err) | ||
806 | goto free_npinfo; | ||
807 | } | ||
800 | } else { | 808 | } else { |
801 | npinfo = ndev->npinfo; | 809 | npinfo = ndev->npinfo; |
802 | atomic_inc(&npinfo->refcnt); | 810 | atomic_inc(&npinfo->refcnt); |
@@ -817,6 +825,8 @@ int netpoll_setup(struct netpoll *np) | |||
817 | 825 | ||
818 | return 0; | 826 | return 0; |
819 | 827 | ||
828 | free_npinfo: | ||
829 | kfree(npinfo); | ||
820 | unlock: | 830 | unlock: |
821 | rtnl_unlock(); | 831 | rtnl_unlock(); |
822 | put: | 832 | put: |