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 <kaber@trash.net>
This commit is contained in:
parent
f5c9434230
commit
20d309fc70
|
@ -337,4 +337,6 @@ struct dect_call {
|
||||||
|
|
||||||
#define DECT_CC_SETUP_TIMEOUT 20 /* seconds */
|
#define DECT_CC_SETUP_TIMEOUT 20 /* seconds */
|
||||||
|
|
||||||
|
extern const struct dect_nwk_protocol dect_cc_protocol;
|
||||||
|
|
||||||
#endif /* _LIBDECT_CC_H */
|
#endif /* _LIBDECT_CC_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 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 */
|
#endif /* _LIBDECT_CLMS_H */
|
||||||
|
|
|
@ -376,4 +376,6 @@ struct dect_mm_endpoint {
|
||||||
uint8_t priv[] __aligned(__alignof__(uint64_t));
|
uint8_t priv[] __aligned(__alignof__(uint64_t));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern const struct dect_nwk_protocol dect_mm_protocol;
|
||||||
|
|
||||||
#endif /* _LIBDECT_MM_H */
|
#endif /* _LIBDECT_MM_H */
|
||||||
|
|
|
@ -78,4 +78,6 @@ enum dect_crss_msg_types {
|
||||||
CRSS_FACILITY = 0x62,
|
CRSS_FACILITY = 0x62,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern const struct dect_nwk_protocol dect_ciss_protocol;
|
||||||
|
|
||||||
#endif /* _LIBDECT_SS_H */
|
#endif /* _LIBDECT_SS_H */
|
||||||
|
|
7
src/cc.c
7
src/cc.c
|
@ -1608,7 +1608,7 @@ static void dect_cc_shutdown(struct dect_handle *dh,
|
||||||
dect_call_destroy(dh, call);
|
dect_call_destroy(dh, call);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dect_nwk_protocol cc_protocol = {
|
const struct dect_nwk_protocol dect_cc_protocol = {
|
||||||
.name = "Call Control",
|
.name = "Call Control",
|
||||||
.pd = DECT_PD_CC,
|
.pd = DECT_PD_CC,
|
||||||
.max_transactions = 7,
|
.max_transactions = 7,
|
||||||
|
@ -1617,9 +1617,4 @@ static const struct dect_nwk_protocol cc_protocol = {
|
||||||
.rcv = dect_cc_rcv,
|
.rcv = dect_cc_rcv,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __init dect_cc_init(void)
|
|
||||||
{
|
|
||||||
dect_lce_register_protocol(&cc_protocol);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -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",
|
.name = "ConnectionLess Message Service",
|
||||||
.pd = DECT_PD_CLMS,
|
.pd = DECT_PD_CLMS,
|
||||||
.max_transactions = 1,
|
.max_transactions = 1,
|
||||||
.open = dect_clms_open,
|
.open = dect_clms_open,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __init dect_clms_init(void)
|
|
||||||
{
|
|
||||||
dect_lce_register_protocol(&clms_protocol);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#include <b_fmt.h>
|
#include <b_fmt.h>
|
||||||
#include <clms.h>
|
#include <clms.h>
|
||||||
#include <lce.h>
|
#include <lce.h>
|
||||||
|
#include <cc.h>
|
||||||
|
#include <mm.h>
|
||||||
#include <ss.h>
|
#include <ss.h>
|
||||||
#include <dect/auth.h>
|
#include <dect/auth.h>
|
||||||
|
|
||||||
|
@ -1499,6 +1501,10 @@ int dect_lce_init(struct dect_handle *dh)
|
||||||
}
|
}
|
||||||
|
|
||||||
dect_lce_register_protocol(&lce_protocol);
|
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;
|
return 0;
|
||||||
|
|
||||||
err4:
|
err4:
|
||||||
|
|
7
src/mm.c
7
src/mm.c
|
@ -3317,7 +3317,7 @@ static void dect_mm_shutdown(struct dect_handle *dh,
|
||||||
proc->abort(dh, mme, mp);
|
proc->abort(dh, mme, mp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct dect_nwk_protocol mm_protocol = {
|
const struct dect_nwk_protocol dect_mm_protocol = {
|
||||||
.name = "Mobility Management",
|
.name = "Mobility Management",
|
||||||
.pd = DECT_PD_MM,
|
.pd = DECT_PD_MM,
|
||||||
.max_transactions = 1,
|
.max_transactions = 1,
|
||||||
|
@ -3327,9 +3327,4 @@ static const struct dect_nwk_protocol mm_protocol = {
|
||||||
.encrypt_ind = dect_mm_encrypt_ind,
|
.encrypt_ind = dect_mm_encrypt_ind,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __init dect_mm_init(void)
|
|
||||||
{
|
|
||||||
dect_lce_register_protocol(&mm_protocol);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
8
src/ss.c
8
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);
|
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",
|
.name = "Call Independant Supplementary Services",
|
||||||
.pd = DECT_PD_CISS,
|
.pd = DECT_PD_CISS,
|
||||||
.max_transactions = 7,
|
.max_transactions = 7,
|
||||||
|
@ -364,9 +364,3 @@ static const struct dect_nwk_protocol ciss_protocol = {
|
||||||
.rcv = dect_ciss_rcv,
|
.rcv = dect_ciss_rcv,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void __init dect_ciss_init(void)
|
|
||||||
{
|
|
||||||
dect_lce_register_protocol(&ciss_protocol);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @} */
|
|
||||||
|
|
Reference in New Issue