pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmocom-bb/+/32428 )

Change subject: layer23: modem: Unregister registered callbacks upon app exit
......................................................................

layer23: modem: Unregister registered callbacks upon app exit

It's just a good practice to delete all resources allocated during startup.
The main aim here is to keep resemblance to what the mobile app is doing,
so that they can slowly be merged and some functionalities from the mobile app 
can be
added to the modem app, like shutting down the MS without killing the process 
eventually.

Change-Id: I5a641fa3dadb6ea7346b25a20215896ab32eb805
---
M src/host/layer23/src/modem/app_modem.c
1 file changed, 25 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved




diff --git a/src/host/layer23/src/modem/app_modem.c 
b/src/host/layer23/src/modem/app_modem.c
index 211621e..12ac4ae 100644
--- a/src/host/layer23/src/modem/app_modem.c
+++ b/src/host/layer23/src/modem/app_modem.c
@@ -114,8 +114,8 @@
        memset(&app_data, 0x00, sizeof(app_data));
 }

-static int signal_cb(unsigned int subsys, unsigned int signal,
-                    void *handler_data, void *signal_data)
+static int global_signal_cb(unsigned int subsys, unsigned int signal,
+                           void *handler_data, void *signal_data)
 {
        struct osmocom_ms *ms;

@@ -151,11 +151,19 @@
        return 0;
 }

+/* global exit */
+static int _modem_exit(void)
+{
+       osmo_signal_unregister_handler(SS_GLOBAL, &global_signal_cb, NULL);
+       return 0;
+}
+
 int l23_app_init(void)
 {
        int rc;

        l23_app_start = _modem_start;
+       l23_app_exit = _modem_exit;

        log_set_category_filter(osmo_stderr_target, DLGLOBAL, 1, LOGL_DEBUG);
        log_set_category_filter(osmo_stderr_target, DLCSN1, 1, LOGL_DEBUG);
@@ -189,7 +197,7 @@
                return rc;
        }

-       osmo_signal_register_handler(SS_L1CTL, &signal_cb, NULL);
+       osmo_signal_register_handler(SS_L1CTL, &global_signal_cb, NULL);
        lapdm_channel_set_l3(&app_data.ms->lapdm_channel, &modem_grr_rslms_cb, 
app_data.ms);
        return 0;
 }

--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/32428
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I5a641fa3dadb6ea7346b25a20215896ab32eb805
Gerrit-Change-Number: 32428
Gerrit-PatchSet: 5
Gerrit-Owner: pespin <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-CC: fixeria <[email protected]>
Gerrit-MessageType: merged

Reply via email to