From 20d309fc70c54fc320c338dfb42802ef60f0d03b Mon Sep 17 00:00:00 2001 From: Patrick McHardy Date: Fri, 3 Sep 2010 12:18:20 +0200 Subject: [PATCH] lce: move protocol registration to dect_lce_init Perform protocol initialization outside of __init functions to avoid multiple registration with threaded library users. Signed-off-by: Patrick McHardy --- include/cc.h | 2 ++ include/clms.h | 2 ++ include/mm.h | 2 ++ include/ss.h | 2 ++ src/cc.c | 7 +------ src/clms.c | 7 +------ src/lce.c | 6 ++++++ src/mm.c | 7 +------ src/ss.c | 8 +------- 9 files changed, 18 insertions(+), 25 deletions(-) diff --git a/include/cc.h b/include/cc.h index 42dc27d..b9142c0 100644 --- a/include/cc.h +++ b/include/cc.h @@ -337,4 +337,6 @@ struct dect_call { #define DECT_CC_SETUP_TIMEOUT 20 /* seconds */ +extern const struct dect_nwk_protocol dect_cc_protocol; + #endif /* _LIBDECT_CC_H */ diff --git a/include/clms.h b/include/clms.h index 93da08e..88c1c31 100644 --- a/include/clms.h +++ b/include/clms.h @@ -70,4 +70,6 @@ enum dect_clms_protocol_discriminators { extern void dect_clms_rcv_fixed(struct dect_handle *dh, struct dect_msg_buf *mb); +extern const struct dect_nwk_protocol dect_clms_protocol; + #endif /* _LIBDECT_CLMS_H */ diff --git a/include/mm.h b/include/mm.h index 1f7fb17..939ecdb 100644 --- a/include/mm.h +++ b/include/mm.h @@ -376,4 +376,6 @@ struct dect_mm_endpoint { uint8_t priv[] __aligned(__alignof__(uint64_t)); }; +extern const struct dect_nwk_protocol dect_mm_protocol; + #endif /* _LIBDECT_MM_H */ diff --git a/include/ss.h b/include/ss.h index d007c40..90801fd 100644 --- a/include/ss.h +++ b/include/ss.h @@ -78,4 +78,6 @@ enum dect_crss_msg_types { CRSS_FACILITY = 0x62, }; +extern const struct dect_nwk_protocol dect_ciss_protocol; + #endif /* _LIBDECT_SS_H */ diff --git a/src/cc.c b/src/cc.c index b886e6e..dcc5f66 100644 --- a/src/cc.c +++ b/src/cc.c @@ -1608,7 +1608,7 @@ static void dect_cc_shutdown(struct dect_handle *dh, dect_call_destroy(dh, call); } -static const struct dect_nwk_protocol cc_protocol = { +const struct dect_nwk_protocol dect_cc_protocol = { .name = "Call Control", .pd = DECT_PD_CC, .max_transactions = 7, @@ -1617,9 +1617,4 @@ static const struct dect_nwk_protocol cc_protocol = { .rcv = dect_cc_rcv, }; -static void __init dect_cc_init(void) -{ - dect_lce_register_protocol(&cc_protocol); -} - /** @} */ diff --git a/src/clms.c b/src/clms.c index d818d58..9621121 100644 --- a/src/clms.c +++ b/src/clms.c @@ -216,16 +216,11 @@ static void dect_clms_open(struct dect_handle *dh, } } -static const struct dect_nwk_protocol clms_protocol = { +const struct dect_nwk_protocol dect_clms_protocol = { .name = "ConnectionLess Message Service", .pd = DECT_PD_CLMS, .max_transactions = 1, .open = dect_clms_open, }; -static void __init dect_clms_init(void) -{ - dect_lce_register_protocol(&clms_protocol); -} - /** @} */ diff --git a/src/lce.c b/src/lce.c index c0c2e78..b2a24a0 100644 --- a/src/lce.c +++ b/src/lce.c @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include #include @@ -1499,6 +1501,10 @@ int dect_lce_init(struct dect_handle *dh) } dect_lce_register_protocol(&lce_protocol); + dect_lce_register_protocol(&dect_cc_protocol); + dect_lce_register_protocol(&dect_ciss_protocol); + dect_lce_register_protocol(&dect_clms_protocol); + dect_lce_register_protocol(&dect_mm_protocol); return 0; err4: diff --git a/src/mm.c b/src/mm.c index 58925ec..790a7c7 100644 --- a/src/mm.c +++ b/src/mm.c @@ -3317,7 +3317,7 @@ static void dect_mm_shutdown(struct dect_handle *dh, proc->abort(dh, mme, mp); } -static const struct dect_nwk_protocol mm_protocol = { +const struct dect_nwk_protocol dect_mm_protocol = { .name = "Mobility Management", .pd = DECT_PD_MM, .max_transactions = 1, @@ -3327,9 +3327,4 @@ static const struct dect_nwk_protocol mm_protocol = { .encrypt_ind = dect_mm_encrypt_ind, }; -static void __init dect_mm_init(void) -{ - dect_lce_register_protocol(&mm_protocol); -} - /** @} */ diff --git a/src/ss.c b/src/ss.c index 1db7733..51c6780 100644 --- a/src/ss.c +++ b/src/ss.c @@ -355,7 +355,7 @@ static void dect_ciss_shutdown(struct dect_handle *dh, dect_transaction_close(dh, &sse->transaction, DECT_DDL_RELEASE_NORMAL); } -static const struct dect_nwk_protocol ciss_protocol = { +const struct dect_nwk_protocol dect_ciss_protocol = { .name = "Call Independant Supplementary Services", .pd = DECT_PD_CISS, .max_transactions = 7, @@ -364,9 +364,3 @@ static const struct dect_nwk_protocol ciss_protocol = { .rcv = dect_ciss_rcv, }; -static void __init dect_ciss_init(void) -{ - dect_lce_register_protocol(&ciss_protocol); -} - -/** @} */