summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2023-05-17 14:57:43 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2023-05-19 13:56:58 +0200
commit8be5119702ac8cedc9691badbe71972d0aa4a155 (patch)
treeffece892cdb2cdc40aa6d0707d45b06f2e739219
parent5906bee946bc235867ee613bbb5a16800931c1a4 (diff)
layer23: Move SAP init/close to be done during MS allocation/destruction
-rw-r--r--src/host/layer23/src/common/ms.c10
-rw-r--r--src/host/layer23/src/mobile/app_mobile.c12
2 files changed, 10 insertions, 12 deletions
diff --git a/src/host/layer23/src/common/ms.c b/src/host/layer23/src/common/ms.c
index f123b1e6..a14cb1eb 100644
--- a/src/host/layer23/src/common/ms.c
+++ b/src/host/layer23/src/common/ms.c
@@ -27,6 +27,12 @@ uint16_t cfg_test_arfcn = 871;
static int osmocom_ms_talloc_destructor(struct osmocom_ms *ms)
{
+
+ if (ms->sap_wq.bfd.fd > -1) {
+ sap_close(ms);
+ ms->sap_wq.bfd.fd = -1;
+ }
+
gprs_settings_fi(ms);
gsm_subscr_exit(ms);
gsm_sim_exit(ms);
@@ -63,6 +69,10 @@ struct osmocom_ms *osmocom_ms_alloc(void *ctx, const char *name)
gsm_support_init(ms);
gsm_settings_init(ms);
gprs_settings_init(ms);
+ /* init SAP client before SIM card starts up */
+ sap_init(ms);
+ /* SAP response call-back */
+ ms->sap_entity.sap_rsp_cb = &gsm_subscr_sap_rsp_cb;
gsm_sim_init(ms);
gsm_subscr_init(ms);
diff --git a/src/host/layer23/src/mobile/app_mobile.c b/src/host/layer23/src/mobile/app_mobile.c
index b314c298..76f11f38 100644
--- a/src/host/layer23/src/mobile/app_mobile.c
+++ b/src/host/layer23/src/mobile/app_mobile.c
@@ -260,12 +260,6 @@ static int mobile_init(struct osmocom_ms *ms)
GSM_LCHAN_SDCCH, NULL);
lapdm_channel_set_l1(&ms->lapdm_channel, l1ctl_ph_prim_cb, ms);
- /* init SAP client before SIM card starts up */
- sap_init(ms);
-
- /* SAP response call-back */
- ms->sap_entity.sap_rsp_cb = &gsm_subscr_sap_rsp_cb;
-
gsm_sim_init(ms);
gsm48_cc_init(ms);
gsm480_ss_init(ms);
@@ -448,12 +442,6 @@ static int _mobile_app_work(void)
layer2_close(ms);
ms->l2_wq.bfd.fd = -1;
}
-
- if (ms->sap_wq.bfd.fd > -1) {
- sap_close(ms);
- ms->sap_wq.bfd.fd = -1;
- }
-
if (ms->deleting) {
gsm_settings_exit(ms);
script_lua_close(ms);