aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/eth_media.c
diff options
context:
space:
mode:
authorJon Paul Maloy <jon.maloy@ericsson.com>2013-12-10 23:45:39 -0500
committerDavid S. Miller <davem@davemloft.net>2013-12-11 00:17:42 -0500
commit5702dbab687e19792102200b085108f00ab820c9 (patch)
treea3f19fccfbaf4043d0de34a76fd476efe9219920 /net/tipc/eth_media.c
parentd77b3831f7d59d69aa49d5d1df10bbe56671dc5d (diff)
tipc: initiate media type array at compile time
Communication media types are abstracted through the struct 'tipc_media', one per media type. These structs are allocated statically inside their respective media file. Furthermore, in order to be able to reach all instances from a central location, we keep a static array with pointers to these structs. This array is currently initialized at runtime, under protection of tipc_net_lock. However, since the contents of the array itself never changes after initialization, we can just as well initialize it at compile time and make it 'const', at the same time making it obvious that no lock protection is needed here. This commit makes the array constant and removes the redundant lock protection. Signed-off-by: Ying Xue <ying.xue@windriver.com> Reviewed-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/eth_media.c')
-rw-r--r--net/tipc/eth_media.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c
index 1e3c33250db3..37fb145476ec 100644
--- a/net/tipc/eth_media.c
+++ b/net/tipc/eth_media.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * net/tipc/eth_media.c: Ethernet bearer support for TIPC 2 * net/tipc/eth_media.c: Ethernet bearer support for TIPC
3 * 3 *
4 * Copyright (c) 2001-2007, Ericsson AB 4 * Copyright (c) 2001-2007, 2013, Ericsson AB
5 * Copyright (c) 2005-2008, 2011-2013, Wind River Systems 5 * Copyright (c) 2005-2008, 2011-2013, Wind River Systems
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
@@ -57,7 +57,7 @@ struct eth_media {
57 struct work_struct cleanup; 57 struct work_struct cleanup;
58}; 58};
59 59
60static struct tipc_media eth_media_info; 60
61static struct eth_media eth_media_array[MAX_ETH_MEDIA]; 61static struct eth_media eth_media_array[MAX_ETH_MEDIA];
62static int eth_started; 62static int eth_started;
63 63
@@ -315,7 +315,7 @@ static int eth_msg2addr(const struct tipc_bearer *tb_ptr,
315/* 315/*
316 * Ethernet media registration info 316 * Ethernet media registration info
317 */ 317 */
318static struct tipc_media eth_media_info = { 318struct tipc_media eth_media_info = {
319 .send_msg = send_msg, 319 .send_msg = send_msg,
320 .enable_media = enable_media, 320 .enable_media = enable_media,
321 .disable_media = disable_media, 321 .disable_media = disable_media,
@@ -342,10 +342,6 @@ int tipc_eth_media_start(void)
342 if (eth_started) 342 if (eth_started)
343 return -EINVAL; 343 return -EINVAL;
344 344
345 res = tipc_register_media(&eth_media_info);
346 if (res)
347 return res;
348
349 res = register_netdevice_notifier(&notifier); 345 res = register_netdevice_notifier(&notifier);
350 if (!res) 346 if (!res)
351 eth_started = 1; 347 eth_started = 1;