diff options
author | Jon Paul Maloy <jon.maloy@ericsson.com> | 2013-12-10 20:45:39 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-11 00:17:42 -0500 |
commit | 5702dbab687e19792102200b085108f00ab820c9 (patch) | |
tree | a3f19fccfbaf4043d0de34a76fd476efe9219920 /net/tipc/bearer.h | |
parent | d77b3831f7d59d69aa49d5d1df10bbe56671dc5d (diff) | |
download | lwn-5702dbab687e19792102200b085108f00ab820c9.tar.gz lwn-5702dbab687e19792102200b085108f00ab820c9.zip |
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/bearer.h')
-rw-r--r-- | net/tipc/bearer.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index cc780bbedbb9..516af8c0577d 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h @@ -1,7 +1,7 @@ /* * net/tipc/bearer.h: Include file for TIPC bearer code * - * Copyright (c) 1996-2006, Ericsson AB + * Copyright (c) 1996-2006, 2013, Ericsson AB * Copyright (c) 2005, 2010-2011, Wind River Systems * All rights reserved. * @@ -157,7 +157,6 @@ extern struct tipc_bearer tipc_bearers[]; /* * TIPC routines available to supported media types */ -int tipc_register_media(struct tipc_media *m_ptr); void tipc_recv_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr); @@ -171,10 +170,12 @@ int tipc_disable_bearer(const char *name); */ int tipc_eth_media_start(void); void tipc_eth_media_stop(void); +extern struct tipc_media eth_media_info; #ifdef CONFIG_TIPC_MEDIA_IB int tipc_ib_media_start(void); void tipc_ib_media_stop(void); +extern struct tipc_media ib_media_info; #else static inline int tipc_ib_media_start(void) { return 0; } static inline void tipc_ib_media_stop(void) { return; } |