Skip to content

Commit

Permalink
tipc: optimize the initialization of network device notifier
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ying Xue authored and David S. Miller committed Aug 20, 2012
1 parent fff3321 commit fa7f86f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions net/tipc/eth_media.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,16 @@ struct eth_bearer {
static struct tipc_media eth_media_info;
static struct eth_bearer eth_bearers[MAX_ETH_BEARERS];
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
Expand Down Expand Up @@ -357,8 +366,6 @@ int tipc_eth_media_start(void)
if (res)
return res;

notifier.notifier_call = &recv_notification;
notifier.priority = 0;
res = register_netdevice_notifier(&notifier);
if (!res)
eth_started = 1;
Expand Down

0 comments on commit fa7f86f

Please sign in to comment.