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/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index aa03891..e6751db 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -227,9 +227,7 @@
mm->num_T_exp = 0;
/* FIXME: we should do this only once ? */
- mm->timer.data = mm;
- mm->timer.cb = &mmctx_timer_cb;
-
+ osmo_timer_setup(&mm->timer, mmctx_timer_cb, mm);
osmo_timer_schedule(&mm->timer, seconds, 0);
}
@@ -2167,9 +2165,7 @@
pdp->num_T_exp = 0;
/* FIXME: we should do this only once ? */
- pdp->timer.data = pdp;
- pdp->timer.cb = &pdpctx_timer_cb;
-
+ osmo_timer_setup(&pdp->timer, pdpctx_timer_cb, pdp);
osmo_timer_schedule(&pdp->timer, seconds, 0);
}
diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c
index 5d9af78..071dd97 100644
--- a/openbsc/src/gprs/gprs_sgsn.c
+++ b/openbsc/src/gprs/gprs_sgsn.c
@@ -889,9 +889,7 @@
void sgsn_inst_init()
{
- sgsn->llme_timer.cb = sgsn_llme_check_cb;
- sgsn->llme_timer.data = NULL;
-
+ osmo_timer_setup(&sgsn->llme_timer, sgsn_llme_check_cb, NULL);
osmo_timer_schedule(&sgsn->llme_timer, GPRS_LLME_CHECK_TICK, 0);
}
diff --git a/openbsc/src/gprs/gtphub.c b/openbsc/src/gprs/gtphub.c
index a1aaed2..211018b 100644
--- a/openbsc/src/gprs/gtphub.c
+++ b/openbsc/src/gprs/gtphub.c
@@ -2438,9 +2438,7 @@
static void gtphub_gc_start(struct gtphub *hub)
{
- hub->gc_timer.cb = gtphub_gc_cb;
- hub->gc_timer.data = hub;
-
+ osmo_timer_setup(&hub->gc_timer, gtphub_gc_cb, hub);
osmo_timer_schedule(&hub->gc_timer, GTPH_GC_TICK_SECONDS, 0);
}
diff --git a/openbsc/src/gprs/sgsn_ares.c b/openbsc/src/gprs/sgsn_ares.c
index dd1bdb5..d94d184 100644
--- a/openbsc/src/gprs/sgsn_ares.c
+++ b/openbsc/src/gprs/sgsn_ares.c
@@ -71,12 +71,10 @@
osmo_timer_del(&sgsn->ares_timer);
timeout = ares_timeout(sgsn->ares_channel, NULL, &tv);
if (timeout) {
- sgsn->ares_timer.cb = ares_timeout_cb;
- sgsn->ares_timer.data = sgsn;
-
LOGP(DGPRS, LOGL_DEBUG, "C-ares scheduling timeout %llu.%llu\n",
(unsigned long long) tv.tv_sec,
(unsigned long long) tv.tv_usec);
+ osmo_timer_setup(&sgsn->ares_timer, ares_timeout_cb, sgsn);
osmo_timer_schedule(&sgsn->ares_timer, tv.tv_sec, tv.tv_usec);
}
}
diff --git a/openbsc/src/gprs/sgsn_cdr.c b/openbsc/src/gprs/sgsn_cdr.c
index bf0d6f7..0910896 100644
--- a/openbsc/src/gprs/sgsn_cdr.c
+++ b/openbsc/src/gprs/sgsn_cdr.c
@@ -227,8 +227,8 @@
clock_gettime(CLOCK_MONOTONIC, &signal_data->pdp->cdr_start);
signal_data->pdp->cdr_charging_id = signal_data->pdp->lib->cid;
cdr_log_pdp(inst, "pdp-act", signal_data->pdp);
- signal_data->pdp->cdr_timer.cb = cdr_pdp_timeout;
- signal_data->pdp->cdr_timer.data = signal_data->pdp;
+ osmo_timer_setup(&signal_data->pdp->cdr_timer, cdr_pdp_timeout,
+ signal_data->pdp);
osmo_timer_schedule(&signal_data->pdp->cdr_timer, inst->cfg.cdr.interval, 0);
break;
case S_SGSN_PDP_DEACT:
diff --git a/openbsc/src/gprs/sgsn_libgtp.c b/openbsc/src/gprs/sgsn_libgtp.c
index c26abc9..001e611 100644
--- a/openbsc/src/gprs/sgsn_libgtp.c
+++ b/openbsc/src/gprs/sgsn_libgtp.c
@@ -845,8 +845,7 @@
}
/* Start GTP re-transmission timer */
- sgi->gtp_timer.cb = sgsn_gtp_tmr_cb;
- sgi->gtp_timer.data = sgi;
+ osmo_timer_setup(&sgi->gtp_timer, sgsn_gtp_tmr_cb, sgi);
sgsn_gtp_tmr_start(sgi);
/* Register callbackcs with libgtp */