aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/ib_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/ib_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/ib_media.c')
-rw-r--r--net/tipc/ib_media.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/net/tipc/ib_media.c b/net/tipc/ib_media.c
index cbe7fe15cc7c..48e1c07842e6 100644
--- a/net/tipc/ib_media.c
+++ b/net/tipc/ib_media.c
@@ -60,7 +60,6 @@ struct ib_media {
60 struct work_struct cleanup; 60 struct work_struct cleanup;
61}; 61};
62 62
63static struct tipc_media ib_media_info;
64static struct ib_media ib_media_array[MAX_IB_MEDIA]; 63static struct ib_media ib_media_array[MAX_IB_MEDIA];
65static int ib_started; 64static int ib_started;
66 65
@@ -311,7 +310,7 @@ static int ib_msg2addr(const struct tipc_bearer *tb_ptr,
311/* 310/*
312 * InfiniBand media registration info 311 * InfiniBand media registration info
313 */ 312 */
314static struct tipc_media ib_media_info = { 313struct tipc_media ib_media_info = {
315 .send_msg = send_msg, 314 .send_msg = send_msg,
316 .enable_media = enable_media, 315 .enable_media = enable_media,
317 .disable_media = disable_media, 316 .disable_media = disable_media,
@@ -338,10 +337,6 @@ int tipc_ib_media_start(void)
338 if (ib_started) 337 if (ib_started)
339 return -EINVAL; 338 return -EINVAL;
340 339
341 res = tipc_register_media(&ib_media_info);
342 if (res)
343 return res;
344
345 res = register_netdevice_notifier(&notifier); 340 res = register_netdevice_notifier(&notifier);
346 if (!res) 341 if (!res)
347 ib_started = 1; 342 ib_started = 1;