浏览代码

tipc: optimize the initialization of network device notifier

Ethernet media initialization is only done when TIPC is started or
switched to network mode. So the initialization of the network device
notifier structure can be moved out of this function and done
statically instead.

Signed-off-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Ying Xue 13 年之前
父节点
当前提交
fa7f86f1bb
共有 1 个文件被更改,包括 10 次插入3 次删除
  1. 10 3
      net/tipc/eth_media.c

+ 10 - 3
net/tipc/eth_media.c

@@ -58,7 +58,16 @@ struct eth_bearer {
 static struct tipc_media eth_media_info;
 static struct tipc_media eth_media_info;
 static struct eth_bearer eth_bearers[MAX_ETH_BEARERS];
 static struct eth_bearer eth_bearers[MAX_ETH_BEARERS];
 static int eth_started;
 static int eth_started;
-static struct notifier_block notifier;
+
+static int recv_notification(struct notifier_block *nb, unsigned long evt,
+			      void *dv);
+/*
+ * Network device notifier info
+ */
+static struct notifier_block notifier = {
+	.notifier_call	= recv_notification,
+	.priority	= 0
+};
 
 
 /**
 /**
  * eth_media_addr_set - initialize Ethernet media address structure
  * eth_media_addr_set - initialize Ethernet media address structure
@@ -357,8 +366,6 @@ int tipc_eth_media_start(void)
 	if (res)
 	if (res)
 		return res;
 		return res;
 
 
-	notifier.notifier_call = &recv_notification;
-	notifier.priority = 0;
 	res = register_netdevice_notifier(&notifier);
 	res = register_netdevice_notifier(&notifier);
 	if (!res)
 	if (!res)
 		eth_started = 1;
 		eth_started = 1;