aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2007-09-16 18:42:43 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:51:21 -0400
commit056925ab3145713e5e83cf8e05ae6fb2f4ace41e (patch)
tree98a5cadc7499acdc6c89ddc4d58f802b17c5d7e7 /net/core
parent30d97d35851f40fd1c108d1b8904aca3c38d0126 (diff)
[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: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c32
1 files changed, 13 insertions, 19 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index cc105ff67db5..080d32c4034f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -906,7 +906,7 @@ rollback:
906 hlist_add_head(&dev->name_hlist, dev_name_hash(net, dev->name)); 906 hlist_add_head(&dev->name_hlist, dev_name_hash(net, dev->name));
907 write_unlock_bh(&dev_base_lock); 907 write_unlock_bh(&dev_base_lock);
908 908
909 ret = raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev); 909 ret = call_netdevice_notifiers(NETDEV_CHANGENAME, dev);
910 ret = notifier_to_errno(ret); 910 ret = notifier_to_errno(ret);
911 911
912 if (ret) { 912 if (ret) {
@@ -932,7 +932,7 @@ rollback:
932 */ 932 */
933void netdev_features_change(struct net_device *dev) 933void netdev_features_change(struct net_device *dev)
934{ 934{
935 raw_notifier_call_chain(&netdev_chain, NETDEV_FEAT_CHANGE, dev); 935 call_netdevice_notifiers(NETDEV_FEAT_CHANGE, dev);
936} 936}
937EXPORT_SYMBOL(netdev_features_change); 937EXPORT_SYMBOL(netdev_features_change);
938 938
@@ -947,8 +947,7 @@ EXPORT_SYMBOL(netdev_features_change);
947void netdev_state_change(struct net_device *dev) 947void netdev_state_change(struct net_device *dev)
948{ 948{
949 if (dev->flags & IFF_UP) { 949 if (dev->flags & IFF_UP) {
950 raw_notifier_call_chain(&netdev_chain, 950 call_netdevice_notifiers(NETDEV_CHANGE, dev);
951 NETDEV_CHANGE, dev);
952 rtmsg_ifinfo(RTM_NEWLINK, dev, 0); 951 rtmsg_ifinfo(RTM_NEWLINK, dev, 0);
953 } 952 }
954} 953}
@@ -1044,7 +1043,7 @@ int dev_open(struct net_device *dev)
1044 /* 1043 /*
1045 * ... and announce new interface. 1044 * ... and announce new interface.
1046 */ 1045 */
1047 raw_notifier_call_chain(&netdev_chain, NETDEV_UP, dev); 1046 call_netdevice_notifiers(NETDEV_UP, dev);
1048 } 1047 }
1049 return ret; 1048 return ret;
1050} 1049}
@@ -1069,7 +1068,7 @@ int dev_close(struct net_device *dev)
1069 * Tell people we are going down, so that they can 1068 * Tell people we are going down, so that they can
1070 * prepare to death, when device is still operating. 1069 * prepare to death, when device is still operating.
1071 */ 1070 */
1072 raw_notifier_call_chain(&netdev_chain, NETDEV_GOING_DOWN, dev); 1071 call_netdevice_notifiers(NETDEV_GOING_DOWN, dev);
1073 1072
1074 dev_deactivate(dev); 1073 dev_deactivate(dev);
1075 1074
@@ -1102,7 +1101,7 @@ int dev_close(struct net_device *dev)
1102 /* 1101 /*
1103 * Tell people we are down 1102 * Tell people we are down
1104 */ 1103 */
1105 raw_notifier_call_chain(&netdev_chain, NETDEV_DOWN, dev); 1104 call_netdevice_notifiers(NETDEV_DOWN, dev);
1106 1105
1107 return 0; 1106 return 0;
1108} 1107}
@@ -3031,8 +3030,7 @@ int dev_change_flags(struct net_device *dev, unsigned flags)
3031 if (dev->flags & IFF_UP && 3030 if (dev->flags & IFF_UP &&
3032 ((old_flags ^ dev->flags) &~ (IFF_UP | IFF_PROMISC | IFF_ALLMULTI | 3031 ((old_flags ^ dev->flags) &~ (IFF_UP | IFF_PROMISC | IFF_ALLMULTI |
3033 IFF_VOLATILE))) 3032 IFF_VOLATILE)))
3034 raw_notifier_call_chain(&netdev_chain, 3033 call_netdevice_notifiers(NETDEV_CHANGE, dev);
3035 NETDEV_CHANGE, dev);
3036 3034
3037 if ((flags ^ dev->gflags) & IFF_PROMISC) { 3035 if ((flags ^ dev->gflags) & IFF_PROMISC) {
3038 int inc = (flags & IFF_PROMISC) ? +1 : -1; 3036 int inc = (flags & IFF_PROMISC) ? +1 : -1;
@@ -3078,8 +3076,7 @@ int dev_set_mtu(struct net_device *dev, int new_mtu)
3078 else 3076 else
3079 dev->mtu = new_mtu; 3077 dev->mtu = new_mtu;
3080 if (!err && dev->flags & IFF_UP) 3078 if (!err && dev->flags & IFF_UP)
3081 raw_notifier_call_chain(&netdev_chain, 3079 call_netdevice_notifiers(NETDEV_CHANGEMTU, dev);
3082 NETDEV_CHANGEMTU, dev);
3083 return err; 3080 return err;
3084} 3081}
3085 3082
@@ -3095,8 +3092,7 @@ int dev_set_mac_address(struct net_device *dev, struct sockaddr *sa)
3095 return -ENODEV; 3092 return -ENODEV;
3096 err = dev->set_mac_address(dev, sa); 3093 err = dev->set_mac_address(dev, sa);
3097 if (!err) 3094 if (!err)
3098 raw_notifier_call_chain(&netdev_chain, 3095 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
3099 NETDEV_CHANGEADDR, dev);
3100 return err; 3096 return err;
3101} 3097}
3102 3098
@@ -3152,8 +3148,7 @@ static int dev_ifsioc(struct net *net, struct ifreq *ifr, unsigned int cmd)
3152 return -EINVAL; 3148 return -EINVAL;
3153 memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data, 3149 memcpy(dev->broadcast, ifr->ifr_hwaddr.sa_data,
3154 min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len)); 3150 min(sizeof ifr->ifr_hwaddr.sa_data, (size_t) dev->addr_len));
3155 raw_notifier_call_chain(&netdev_chain, 3151 call_netdevice_notifiers(NETDEV_CHANGEADDR, dev);
3156 NETDEV_CHANGEADDR, dev);
3157 return 0; 3152 return 0;
3158 3153
3159 case SIOCGIFMAP: 3154 case SIOCGIFMAP:
@@ -3597,7 +3592,7 @@ int register_netdevice(struct net_device *dev)
3597 list_netdevice(dev); 3592 list_netdevice(dev);
3598 3593
3599 /* Notify protocols, that a new device appeared. */ 3594 /* Notify protocols, that a new device appeared. */
3600 ret = raw_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev); 3595 ret = call_netdevice_notifiers(NETDEV_REGISTER, dev);
3601 ret = notifier_to_errno(ret); 3596 ret = notifier_to_errno(ret);
3602 if (ret) 3597 if (ret)
3603 unregister_netdevice(dev); 3598 unregister_netdevice(dev);
@@ -3668,8 +3663,7 @@ static void netdev_wait_allrefs(struct net_device *dev)
3668 rtnl_lock(); 3663 rtnl_lock();
3669 3664
3670 /* Rebroadcast unregister notification */ 3665 /* Rebroadcast unregister notification */
3671 raw_notifier_call_chain(&netdev_chain, 3666 call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
3672 NETDEV_UNREGISTER, dev);
3673 3667
3674 if (test_bit(__LINK_STATE_LINKWATCH_PENDING, 3668 if (test_bit(__LINK_STATE_LINKWATCH_PENDING,
3675 &dev->state)) { 3669 &dev->state)) {
@@ -3914,7 +3908,7 @@ void unregister_netdevice(struct net_device *dev)
3914 /* Notify protocols, that we are about to destroy 3908 /* Notify protocols, that we are about to destroy
3915 this device. They should clean all the things. 3909 this device. They should clean all the things.
3916 */ 3910 */
3917 raw_notifier_call_chain(&netdev_chain, NETDEV_UNREGISTER, dev); 3911 call_netdevice_notifiers(NETDEV_UNREGISTER, dev);
3918 3912
3919 /* 3913 /*
3920 * Flush the unicast and multicast chains 3914 * Flush the unicast and multicast chains