Commit 056925ab authored by Pavel Emelyanov's avatar Pavel Emelyanov Committed by David S. Miller

[NET]: Cleanup calling netdev notifiers.

The call_netdev_notifiers routine can successfully be used in
the net/core_dev.c itself.

This will save 6 lines of code and 62 ;) bytes of .text section.

62 is rather small, but I have one more patch saving ~30 bytes
from netns code (sent to Eric), so altogether they can save
some more noticeable amount.
Signed-off-by: default avatarPavel Emelyanov <xemul@openvz.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 30d97d35
...@@ -906,7 +906,7 @@ int dev_change_name(struct net_device *dev, char *newname) ...@@ -906,7 +906,7 @@ int dev_change_name(struct net_device *dev, char *newname)
hlist_add_head(&dev->name_hlist, dev_name_hash(net, dev->name)); hlist_add_head(&dev->name_hlist, dev_name_hash(net, dev->name));
write_unlock_bh(&dev_base_lock); write_unlock_bh(&dev_base_lock);
ret = raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev); ret = call_netdevice_notifiers(NETDEV_CHANGENAME, dev);
ret = notifier_to_errno(ret); ret = notifier_to_errno(ret);
if (ret) { if (ret) {
...@@ -932,7 +932,7 @@ int dev_change_name(struct net_device *dev, char *newname) ...@@ -932,7 +932,7 @@ int dev_change_name(struct net_device *dev, char *newname)
*/ */
void netdev_features_change(struct net_device *dev) void netdev_features_change(struct net_device *dev)
{ {
raw_notifier_call_chain(&netdev_chain, NETDEV_FEAT_CHANGE, dev); call_netdevice_notifiers(NETDEV_FEAT_CHANGE, dev);
} }
EXPORT_SYMBOL(netdev_features_change); EXPORT_SYMBOL(netdev_features_change);
...@@ -947,8 +947,7 @@ EXPORT_SYMBOL(netdev_features_change); ...@@ -947,8 +947,7 @@ EXPORT_SYMBOL(netdev_features_change);
void netdev_state_change(struct net_device *dev) void netdev_state_change(struct net_device *dev)
{ {
if (dev->flags & IFF_UP) { if (dev->flags & IFF_UP) {
raw_notifier_call_chain(&netdev_chain, call_netdevice_notifiers(NETDEV_CHANGE, dev);
NETDEV_CHANGE, dev);
rtmsg_ifinfo(RTM_NEWLINK, dev, 0); rtmsg_ifinfo(RTM_NEWLINK, dev, 0);
} }
} }
...@@ -1044,7 +1043,7 @@ int dev_open(struct net_device *dev) ...@@ -1044,7 +1043,7 @@ int dev_open(struct net_device *dev)
/* /*
* ... and announce new interface. * ... and announce new interface.
*/ */
raw_notifier_call_chain(&netdev_chain, NETDEV_UP, dev); call_netdevice_notifiers(NETDEV_UP, dev);
} }
return ret; return ret;
} }
...@@ -1069,7 +1068,7 @@ int dev_close(struct net_device *dev) ...@@ -1069,7 +1068,7 @@ int dev_close(struct net_device *dev)
* Tell people we are going down, so that they can * Tell people we are going down, so that they can
* prepare to death, when device is still operating. * prepare to death, when device is still operating.
*/ */
raw_notifier_call_chain(&netdev_chain, NETDEV_GOING_DOWN, dev); call_netdevice_notifiers(NETDEV_GOING_DOWN, dev);
dev_deactivate(dev); dev_deactivate(dev);
...@@ -1102,7 +1101,7 @@ int dev_close(struct net_device *dev) ...@@ -1102,7 +1101,7 @@ int dev_close(struct net_device *dev)
/* /*
* Tell people we are down * Tell people we are down
*/ */
raw_notifier_call_chain(&netdev_chain, NETDEV_DOWN, dev); call_netdevice_notifiers(NETDEV_DOWN, dev);
return 0; return 0;
} }
...@@ -3031,8 +3030,7 @@ int dev_change_flags(struct net_device *dev, unsigned flags) ...@@ -3031,8 +3030,7 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
if (dev->flags & IFF_UP && if (dev->flags & IFF_UP &&
((old_flags ^ dev->flags) &~ (IFF_UP | IFF_PROMISC | IFF_ALLMULTI | ((old_flags ^ dev->flags) &~ (IFF_UP | IFF_PROMISC | IFF_ALLMULTI |
IFF_VOLATILE))) IFF_VOLATILE)))
raw_notifier_call_chain(&netdev_chain, call_netdevice_notifiers(NETDEV_CHANGE, dev);
NETDEV_CHANGE, dev);
if ((flags ^ dev->gflags) & IFF_PROMISC) { if ((flags ^ dev->gflags) & IFF_PROMISC) {
int inc = (flags & IFF_PROMISC) ? +1 : -1; int inc = (flags & IFF_PROMISC) ? +1 : -1;
...@@ -3078,8 +3076,7 @@ int dev_set_mtu(struct net_device *dev, int new_mtu) ...@@ -3078,8 +3076,7 @@ int dev_set_mtu(struct net_device *dev, int new_mtu)
else else
dev->mtu = new_mtu; dev->mtu = new_mtu;
if (!err && dev->flags & IFF_UP) if (!err && dev->flags & IFF_UP)
raw_notifier_call_chain(&netdev_chain, call_netdevice_notifiers(NETDEV_CHANGEMTU, dev);
NETDEV_CHANGEMTU, dev);
return err; return err;
} }
...@@ -3095,8 +3092,7 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa) ...@@ -3095,8 +3092,7 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa)
return -ENODEV; return -ENODEV;
err = dev->set_mac_address(dev, sa); err = dev->set_mac_address(dev, sa);
if (!err) if (!err)
raw_notifier_call_chain(&netdev_chain, call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
NETDEV_CHANGEADDR, dev);
return err; return err;
} }
...@@ -3152,8 +3148,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd) ...@@ -3152,8 +3148,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd)
return -EINVAL; return -EINVAL;
memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data, memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data,
min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len)); min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len));
raw_notifier_call_chain(&netdev_chain, call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
NETDEV_CHANGEADDR, dev);
return 0; return 0;
case SIOCGIFMAP: case SIOCGIFMAP:
...@@ -3597,7 +3592,7 @@ int register_netdevice(struct net_device *dev) ...@@ -3597,7 +3592,7 @@ int register_netdevice(struct net_device *dev)
list_netdevice(dev); list_netdevice(dev);
/* Notify protocols, that a new device appeared. */ /* Notify protocols, that a new device appeared. */
ret = raw_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev); ret = call_netdevice_notifiers(NETDEV_REGISTER, dev);
ret = notifier_to_errno(ret); ret = notifier_to_errno(ret);
if (ret) if (ret)
unregister_netdevice(dev); unregister_netdevice(dev);
...@@ -3668,8 +3663,7 @@ static void netdev_wait_allrefs(struct net_device *dev) ...@@ -3668,8 +3663,7 @@ static void netdev_wait_allrefs(struct net_device *dev)
rtnl_lock(); rtnl_lock();
/* Rebroadcast unregister notification */ /* Rebroadcast unregister notification */
raw_notifier_call_chain(&netdev_chain, call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
NETDEV_UNREGISTER, dev);
if (test_bit(__LINK_STATE_LINKWATCH_PENDING, if (test_bit(__LINK_STATE_LINKWATCH_PENDING,
&dev->state)) { &dev->state)) {
...@@ -3914,7 +3908,7 @@ void unregister_netdevice(struct net_device *dev) ...@@ -3914,7 +3908,7 @@ void unregister_netdevice(struct net_device *dev)
/* Notify protocols, that we are about to destroy /* Notify protocols, that we are about to destroy
this device. They should clean all the things. this device. They should clean all the things.
*/ */
raw_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev); call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
/* /*
* Flush the unicast and multicast chains * Flush the unicast and multicast chains
......
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