summaryrefslogtreecommitdiffstats
path: root/src/host/layer23/src/common
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2019-02-02 12:16:44 +0300
committerVadim Yanitskiy <axilirator@gmail.com>2019-02-02 12:16:44 +0300
commitea5804398ab956fefb3dc71ff4bbc5767c7e0012 (patch)
tree969f67bbb65c4e5d1187ef54886921ea38bc10ca /src/host/layer23/src/common
parentf4ba6382f57e0fb4b1e4b21a9112f6a87ef492ff (diff)
common/sap_fsm.c: register SAP FSM on DSO load
Diffstat (limited to 'src/host/layer23/src/common')
-rw-r--r--src/host/layer23/src/common/sap_fsm.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/host/layer23/src/common/sap_fsm.c b/src/host/layer23/src/common/sap_fsm.c
index 9591dabd..f07488f0 100644
--- a/src/host/layer23/src/common/sap_fsm.c
+++ b/src/host/layer23/src/common/sap_fsm.c
@@ -674,10 +674,6 @@ int sap_fsm_alloc(struct osmocom_ms *ms)
sap = &ms->sap_entity;
OSMO_ASSERT(sap->fi == NULL);
- /* Register our FSM (if required) */
- if (!osmo_fsm_find_by_name(sap_fsm_def.name))
- OSMO_ASSERT(osmo_fsm_register(&sap_fsm_def) == 0);
-
/* Allocate an instance using ms as talloc context */
sap->fi = osmo_fsm_inst_alloc(&sap_fsm_def, ms,
ms, LOGL_DEBUG, ms->name);
@@ -688,3 +684,8 @@ int sap_fsm_alloc(struct osmocom_ms *ms)
return 0;
}
+
+static __attribute__((constructor)) void on_dso_load(void)
+{
+ OSMO_ASSERT(osmo_fsm_register(&sap_fsm_def) == 0);
+}