[PATCH] Cleanup calling netdev notifiers

Previous thread: [PATCH 0/10 REV5] Implement skb batching and support in IPoIB/E1000 by Krishna Kumar on Friday, September 14, 2007 - 2:00 am. (101 messages)

Next thread: [PATCH] NET_SB1250_MAC: Update Kconfig entry by Maciej W. Rozycki on Friday, September 14, 2007 - 3:57 am. (2 messages)
From: Pavel Emelyanov
Date: Friday, September 14, 2007 - 3:34 am

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>

---

 net/core/dev.c |   32 +++++++++++++-------------------
 1 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index a76021c..c1c292f 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -850,7 +850,7 @@ rollback:
 	hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
 	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);
 
 	if (ret) {
@@ -876,7 +876,7 @@ rollback:
  */
 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);
 
@@ -891,8 +891,7 @@ EXPORT_SYMBOL(netdev_features_change);
 void netdev_state_change(struct net_device *dev)
 {
 	if (dev->flags & IFF_UP) {
-		raw_notifier_call_chain(&netdev_chain,
-				NETDEV_CHANGE, dev);
+		call_netdevice_notifiers(NETDEV_CHANGE, dev);
 		rtmsg_ifinfo(RTM_NEWLINK, dev, 0);
 	}
 }
@@ -988,7 +987,7 @@ int dev_open(struct net_device *dev)
 		/*
 		 *	... and announce new interface.
 		 */
-		raw_notifier_call_chain(&netdev_chain, NETDEV_UP, dev);
+		call_netdevice_notifiers(NETDEV_UP, dev);
 	}
 	return ret;
 }
@@ -1011,7 +1010,7 @@ int dev_close(struct net_device *dev)
 	 *	Tell people we are going down, so that they can
 	 *	prepare to death, when device is still operating.
 	 */
-	raw_notifier_call_chain(&netdev_chain, NETDEV_GOING_DOWN, dev);
+	call_netdevice_notifiers(NETDEV_GOING_DOWN, ...
From: David Miller
Date: Sunday, September 16, 2007 - 3:43 pm

From: Pavel Emelyanov <xemul@openvz.org>

Applied to net-2.6.24, thanks Pavel.
-

Previous thread: [PATCH 0/10 REV5] Implement skb batching and support in IPoIB/E1000 by Krishna Kumar on Friday, September 14, 2007 - 2:00 am. (101 messages)

Next thread: [PATCH] NET_SB1250_MAC: Update Kconfig entry by Maciej W. Rozycki on Friday, September 14, 2007 - 3:57 am. (2 messages)