Skip to content

Commit

Permalink
netpoll: remove return value from netpoll_rx_disable()
Browse files Browse the repository at this point in the history
The netpoll_rx_disable() will always return 0, it is no use and looks wordy,
so remove the unnecessary code and get rid of it in _dev_open and _dev_close.

Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
dingtianhong authored and David S. Miller committed May 28, 2013
1 parent 87227b8 commit da6e378
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
4 changes: 2 additions & 2 deletions include/linux/netpoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ struct netpoll_info {
};

#ifdef CONFIG_NETPOLL
extern int netpoll_rx_disable(struct net_device *dev);
extern void netpoll_rx_disable(struct net_device *dev);
extern void netpoll_rx_enable(struct net_device *dev);
#else
static inline int netpoll_rx_disable(struct net_device *dev) { return 0; }
static inline void netpoll_rx_disable(struct net_device *dev) { return; }
static inline void netpoll_rx_enable(struct net_device *dev) { return; }
#endif

Expand Down
15 changes: 4 additions & 11 deletions net/core/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1198,9 +1198,7 @@ static int __dev_open(struct net_device *dev)
* If we don't do this there is a chance ndo_poll_controller
* or ndo_poll may be running while we open the device
*/
ret = netpoll_rx_disable(dev);
if (ret)
return ret;
netpoll_rx_disable(dev);

ret = call_netdevice_notifiers(NETDEV_PRE_UP, dev);
ret = notifier_to_errno(ret);
Expand Down Expand Up @@ -1309,9 +1307,7 @@ static int __dev_close(struct net_device *dev)
LIST_HEAD(single);

/* Temporarily disable netpoll until the interface is down */
retval = netpoll_rx_disable(dev);
if (retval)
return retval;
netpoll_rx_disable(dev);

list_add(&dev->unreg_list, &single);
retval = __dev_close_many(&single);
Expand Down Expand Up @@ -1353,22 +1349,19 @@ static int dev_close_many(struct list_head *head)
*/
int dev_close(struct net_device *dev)
{
int ret = 0;
if (dev->flags & IFF_UP) {
LIST_HEAD(single);

/* Block netpoll rx while the interface is going down */
ret = netpoll_rx_disable(dev);
if (ret)
return ret;
netpoll_rx_disable(dev);

list_add(&dev->unreg_list, &single);
dev_close_many(&single);
list_del(&single);

netpoll_rx_enable(dev);
}
return ret;
return 0;
}
EXPORT_SYMBOL(dev_close);

Expand Down
3 changes: 1 addition & 2 deletions net/core/netpoll.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ static void netpoll_poll_dev(struct net_device *dev)
zap_completion_queue();
}

int netpoll_rx_disable(struct net_device *dev)
void netpoll_rx_disable(struct net_device *dev)
{
struct netpoll_info *ni;
int idx;
Expand All @@ -257,7 +257,6 @@ int netpoll_rx_disable(struct net_device *dev)
if (ni)
down(&ni->dev_lock);
srcu_read_unlock(&netpoll_srcu, idx);
return 0;
}
EXPORT_SYMBOL(netpoll_rx_disable);

Expand Down

0 comments on commit da6e378

Please sign in to comment.