aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bts-oc2g/oml.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-06-18 19:36:12 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-06-23 14:53:37 +0200
commit8090df2a813a3cf174afb8acb9aba92b65d275fb (patch)
treecee14c7b8e18b81ea7542c0133c7bd6aa2ee1631 /src/osmo-bts-oc2g/oml.c
parentceb80fc6b6edcc701a423d6bfe8601b08ff3a10d (diff)
bts_model: Convert bts_model_trx_close() to return asynchronously
Some backends like osmo-bts-trx require exchanging messages like POWEROFF to close the TRX, and hence need some time. Switch the function to expect result asynchronously by calling a callback. This will be used later to wait until all TRX are really powered off before exiting the process. Change-Id: I7d76b600fc06e1114b35bf0c2d08eff5bbd1b69a
Diffstat (limited to 'src/osmo-bts-oc2g/oml.c')
-rw-r--r--src/osmo-bts-oc2g/oml.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/osmo-bts-oc2g/oml.c b/src/osmo-bts-oc2g/oml.c
index cc8d02d6..89ee0ace 100644
--- a/src/osmo-bts-oc2g/oml.c
+++ b/src/osmo-bts-oc2g/oml.c
@@ -457,20 +457,24 @@ static int trx_close_compl_cb(struct gsm_bts_trx *trx, struct msgb *l1_msg,
void *data)
{
msgb_free(l1_msg);
+ bts_model_trx_close_cb(trx, 0);
return 0;
}
-int bts_model_trx_close(struct gsm_bts_trx *trx)
+void bts_model_trx_close(struct gsm_bts_trx *trx)
{
struct oc2gl1_hdl *fl1h = trx_oc2gl1_hdl(trx);
struct msgb *msg;
+ int rc;
msg = l1p_msgb_alloc();
prim_init(msgb_l1prim(msg), GsmL1_PrimId_MphCloseReq, fl1h,
l1p_handle_for_trx(trx));
LOGP(DL1C, LOGL_NOTICE, "Close TRX %u\n", trx->nr);
- return l1if_gsm_req_compl(fl1h, msg, trx_close_compl_cb, NULL);
+ rc = l1if_gsm_req_compl(fl1h, msg, trx_close_compl_cb, NULL);
+ if (rc < 0)
+ bts_model_trx_close_cb(trx, rc);
}
static int trx_rf_lock(struct gsm_bts_trx *trx, int locked, l1if_compl_cb *cb)