src: use osmo_timer_setup()
Use new function available in libosmocore to set up timers. Compile
tested only.
Change-Id: Ibcfd915688e97d370a888888a83a7c95cbe16819
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index be687eb..20dd2b5 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -73,8 +73,7 @@
{
/* We start the error timer to make the channel available again */
if (lchan->state == LCHAN_S_REL_ERR) {
- lchan->error_timer.data = lchan;
- lchan->error_timer.cb = error_timeout_cb;
+ osmo_timer_setup(&lchan->error_timer, error_timeout_cb, lchan);
osmo_timer_schedule(&lchan->error_timer,
lchan->ts->trx->bts->network->T3111 + 2, 0);
} else {
@@ -890,8 +889,7 @@
}
/* Start another timer or assume the BTS sends a ACK/NACK? */
- lchan->act_timer.cb = lchan_deact_tmr_cb;
- lchan->act_timer.data = lchan;
+ osmo_timer_setup(&lchan->act_timer, lchan_deact_tmr_cb, lchan);
osmo_timer_schedule(&lchan->act_timer, 4, 0);
rc = abis_rsl_sendmsg(msg);
@@ -1200,8 +1198,7 @@
&& release_mode == RSL_REL_LOCAL_END) {
DEBUGP(DRLL, "Scheduling release, becasuse Nokia InSite BTS does not send a RELease CONFirm.\n");
lchan->sapis[link_id & 0x7] = LCHAN_SAPI_REL;
- lchan->rel_work.cb = lchan_rel_work_cb;
- lchan->rel_work.data = lchan;
+ osmo_timer_setup(&lchan->rel_work, lchan_rel_work_cb, lchan);
osmo_timer_schedule(&lchan->rel_work, 0, 0);
}
@@ -1857,8 +1854,7 @@
lchan->tch_mode = GSM48_CMODE_SIGN;
/* Start another timer or assume the BTS sends a ACK/NACK? */
- lchan->act_timer.cb = lchan_act_tmr_cb;
- lchan->act_timer.data = lchan;
+ osmo_timer_setup(&lchan->act_timer, lchan_act_tmr_cb, lchan);
osmo_timer_schedule(&lchan->act_timer, 4, 0);
DEBUGP(DRSL, "%s Activating ARFCN(%u) SS(%u) lctype %s "
@@ -1898,8 +1894,7 @@
ia->l2_plen = GSM48_LEN2PLEN((sizeof(*ia)-1) + ia->mob_alloc_len);
/* Start timer T3101 to wait for GSM48_MT_RR_PAG_RESP */
- lchan->T3101.cb = t3101_expired;
- lchan->T3101.data = lchan;
+ osmo_timer_setup(&lchan->T3101, t3101_expired, lchan);
osmo_timer_schedule(&lchan->T3101, bts->network->T3101, 0);
/* send IMMEDIATE ASSIGN CMD on RSL to BTS (to send on CCCH to MS) */
@@ -2031,8 +2026,7 @@
/* Stop T3109 and wait for T3111 before re-using the channel */
osmo_timer_del(&lchan->T3109);
- lchan->T3111.cb = t3111_expired;
- lchan->T3111.data = lchan;
+ osmo_timer_setup(&lchan->T3111, t3111_expired, lchan);
bts = lchan->ts->trx->bts;
osmo_timer_schedule(&lchan->T3111, bts->network->T3111, 0);
}
@@ -2631,8 +2625,7 @@
/* During switchover, we have received a release ack, which means that
* the act_timer has been stopped. Start the timer again so we mark
* this channel broken if the activation ack comes too late. */
- lchan->act_timer.cb = lchan_act_tmr_cb;
- lchan->act_timer.data = lchan;
+ osmo_timer_setup(&lchan->act_timer, lchan_act_tmr_cb, lchan);
osmo_timer_schedule(&lchan->act_timer, 4, 0);
rc = rsl_chan_activate_lchan(lchan, act_type, ho_ref);
@@ -2836,8 +2829,7 @@
if (bts->network->T3109 == 0)
return -1;
- lchan->T3109.cb = t3109_expired;
- lchan->T3109.data = lchan;
+ osmo_timer_setup(&lchan->T3109, t3109_expired, lchan);
osmo_timer_schedule(&lchan->T3109, bts->network->T3109, 0);
return 0;
}
diff --git a/openbsc/src/libbsc/bsc_api.c b/openbsc/src/libbsc/bsc_api.c
index 253326f..4dba3e9 100644
--- a/openbsc/src/libbsc/bsc_api.c
+++ b/openbsc/src/libbsc/bsc_api.c
@@ -406,8 +406,7 @@
}
/* we will now start the timer to complete the assignment */
- conn->T10.cb = assignment_t10_timeout;
- conn->T10.data = conn;
+ osmo_timer_setup(&conn->T10, assignment_t10_timeout, conn);
osmo_timer_schedule(&conn->T10, GSM0808_T10_VALUE);
return 0;
diff --git a/openbsc/src/libbsc/bsc_msc.c b/openbsc/src/libbsc/bsc_msc.c
index e373679..82a572d 100644
--- a/openbsc/src/libbsc/bsc_msc.c
+++ b/openbsc/src/libbsc/bsc_msc.c
@@ -211,8 +211,7 @@
"MSC(%s) Connection in progress\n", con->name);
fd->when = BSC_FD_WRITE;
fd->cb = msc_connection_connect;
- con->timeout_timer.cb = msc_con_timeout;
- con->timeout_timer.data = con;
+ osmo_timer_setup(&con->timeout_timer, msc_con_timeout, con);
osmo_timer_schedule(&con->timeout_timer, 20, 0);
} else if (ret < 0) {
perror("Connection failed");
@@ -277,8 +276,7 @@
{
LOGP(DMSC, LOGL_NOTICE,
"Attempting to reconnect to the MSC(%s)\n", con->name);
- con->reconnect_timer.cb = reconnect_msc;
- con->reconnect_timer.data = con;
+ osmo_timer_setup(&con->reconnect_timer, reconnect_msc, con);
osmo_timer_schedule(&con->reconnect_timer, 5, 0);
}
diff --git a/openbsc/src/libbsc/bsc_rf_ctrl.c b/openbsc/src/libbsc/bsc_rf_ctrl.c
index d13c685..b7b6fc8 100644
--- a/openbsc/src/libbsc/bsc_rf_ctrl.c
+++ b/openbsc/src/libbsc/bsc_rf_ctrl.c
@@ -266,8 +266,7 @@
return 0;
}
- rf->grace_timeout.cb = grace_timeout;
- rf->grace_timeout.data = rf;
+ osmo_timer_setup(&rf->grace_timeout, grace_timeout, rf);
osmo_timer_schedule(&rf->grace_timeout, rf->gsm_network->bsc_data->mid_call_timeout, 0);
LOGP(DLINP, LOGL_NOTICE, "Going to switch RF off in %d seconds.\n",
rf->gsm_network->bsc_data->mid_call_timeout);
@@ -514,15 +513,12 @@
rf->last_rf_lock_ctrl_command = talloc_strdup(rf, "");
/* check the rf state */
- rf->rf_check.data = rf;
- rf->rf_check.cb = rf_check_cb;
+ osmo_timer_setup(&rf->rf_check, rf_check_cb, rf);
/* delay cmd handling */
- rf->delay_cmd.data = rf;
- rf->delay_cmd.cb = rf_delay_cmd_cb;
+ osmo_timer_setup(&rf->delay_cmd, rf_delay_cmd_cb, rf);
- rf->auto_off_timer.data = rf;
- rf->auto_off_timer.cb = rf_auto_off_cb;
+ osmo_timer_setup(&rf->auto_off_timer, rf_auto_off_cb, rf);
/* listen to RF signals */
osmo_signal_register_handler(SS_MSC, msc_signal_handler, net);
diff --git a/openbsc/src/libbsc/bsc_rll.c b/openbsc/src/libbsc/bsc_rll.c
index f2b65ca..bb488da 100644
--- a/openbsc/src/libbsc/bsc_rll.c
+++ b/openbsc/src/libbsc/bsc_rll.c
@@ -89,9 +89,7 @@
llist_add(&rllr->list, &bsc_rll_reqs);
- rllr->timer.cb = &timer_cb;
- rllr->timer.data = rllr;
-
+ osmo_timer_setup(&rllr->timer, timer_cb, rllr);
osmo_timer_schedule(&rllr->timer, 7, 0);
/* send the RSL RLL ESTablish REQuest */
diff --git a/openbsc/src/libbsc/bts_nokia_site.c b/openbsc/src/libbsc/bts_nokia_site.c
index 32a885c..3ca76c0 100644
--- a/openbsc/src/libbsc/bts_nokia_site.c
+++ b/openbsc/src/libbsc/bts_nokia_site.c
@@ -1560,8 +1560,8 @@
*/
bts->nokia.wait_reset = 1;
- bts->nokia.reset_timer.cb = &reset_timer_cb;
- bts->nokia.reset_timer.data = bts;
+ osmo_timer_setup(&bts->nokia.reset_timer,
+ reset_timer_cb, bts);
osmo_timer_schedule(&bts->nokia.reset_timer, bts->nokia.bts_reset_timer_cnf, 0);
struct gsm_e1_subslot *e1_link = &bts->oml_e1_link;
diff --git a/openbsc/src/libbsc/handover_logic.c b/openbsc/src/libbsc/handover_logic.c
index ffcca66..4dd913b 100644
--- a/openbsc/src/libbsc/handover_logic.c
+++ b/openbsc/src/libbsc/handover_logic.c
@@ -216,8 +216,7 @@
/* start T3103. We can continue either with T3103 expiration,
* 04.08 HANDOVER COMPLETE or 04.08 HANDOVER FAIL */
- ho->T3103.cb = ho_T3103_cb;
- ho->T3103.data = ho;
+ osmo_timer_setup(&ho->T3103, ho_T3103_cb, ho);
osmo_timer_schedule(&ho->T3103, 10, 0);
/* create a RTP connection */
diff --git a/openbsc/src/libbsc/paging.c b/openbsc/src/libbsc/paging.c
index bd23d89..78e39c5 100644
--- a/openbsc/src/libbsc/paging.c
+++ b/openbsc/src/libbsc/paging.c
@@ -188,8 +188,8 @@
* to zero and we do not get any messages.
*/
if (paging_bts->available_slots == 0) {
- paging_bts->credit_timer.cb = paging_give_credit;
- paging_bts->credit_timer.data = paging_bts;
+ osmo_timer_setup(&paging_bts->credit_timer, paging_give_credit,
+ paging_bts);
osmo_timer_schedule(&paging_bts->credit_timer, 5, 0);
return;
}
@@ -230,8 +230,8 @@
bts->paging.bts = bts;
INIT_LLIST_HEAD(&bts->paging.pending_requests);
- bts->paging.work_timer.cb = paging_worker;
- bts->paging.work_timer.data = &bts->paging;
+ osmo_timer_setup(&bts->paging.work_timer, paging_worker,
+ &bts->paging);
/* Large number, until we get a proper message */
bts->paging.available_slots = 20;
@@ -299,8 +299,7 @@
req->chan_type = type;
req->cbfn = cbfn;
req->cbfn_param = data;
- req->T3113.cb = paging_T3113_expired;
- req->T3113.data = req;
+ osmo_timer_setup(&req->T3113, paging_T3113_expired, req);
osmo_timer_schedule(&req->T3113, bts->network->T3113, 0);
llist_add_tail(&req->entry, &bts_entry->pending_requests);
paging_schedule_if_needed(bts_entry);