fixeria has submitted this change. (
https://gerrit.osmocom.org/c/osmocom-bb/+/41905?usp=email )
Change subject: trxcon/l1sched: add and use l1sched_del_all_ts()
......................................................................
trxcon/l1sched: add and use l1sched_del_all_ts()
Change-Id: I35ce97459dcd0e2cac4ab8927f02fe0232aa6142
---
M src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h
M src/host/trxcon/src/sched_trx.c
2 files changed, 12 insertions(+), 9 deletions(-)
Approvals:
Jenkins Builder: Verified
laforge: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
diff --git a/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h
b/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h
index d145929..b2fc99d 100644
--- a/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h
+++ b/src/host/trxcon/include/osmocom/bb/l1sched/l1sched.h
@@ -343,6 +343,7 @@
/* Timeslot management functions */
struct l1sched_ts *l1sched_add_ts(struct l1sched_state *sched, int tn);
void l1sched_del_ts(struct l1sched_state *sched, int tn);
+void l1sched_del_all_ts(struct l1sched_state *sched);
int l1sched_reset_ts(struct l1sched_state *sched, int tn);
int l1sched_configure_ts(struct l1sched_state *sched, int tn,
enum gsm_phys_chan_config config);
diff --git a/src/host/trxcon/src/sched_trx.c b/src/host/trxcon/src/sched_trx.c
index e3b1674..f9bd0da 100644
--- a/src/host/trxcon/src/sched_trx.c
+++ b/src/host/trxcon/src/sched_trx.c
@@ -166,33 +166,26 @@
void l1sched_free(struct l1sched_state *sched)
{
- unsigned int tn;
-
if (sched == NULL)
return;
LOGP_SCHEDC(sched, LOGL_NOTICE, "Shutdown scheduler\n");
/* Free all potentially allocated timeslots */
- for (tn = 0; tn < ARRAY_SIZE(sched->ts); tn++)
- l1sched_del_ts(sched, tn);
+ l1sched_del_all_ts(sched);
talloc_free(sched);
}
void l1sched_reset(struct l1sched_state *sched)
{
- unsigned int tn;
-
if (sched == NULL)
return;
LOGP_SCHEDC(sched, LOGL_NOTICE, "Reset scheduler\n");
/* Free all potentially allocated timeslots */
- for (tn = 0; tn < ARRAY_SIZE(sched->ts); tn++)
- l1sched_del_ts(sched, tn);
-
+ l1sched_del_all_ts(sched);
/* Reset UL SACCH cache */
l1sched_sacch_cache_update(sched, meas_rep_dummy);
@@ -255,6 +248,15 @@
l1sched_cfg_pchan_comb_ind(sched, tn, GSM_PCHAN_NONE);
}
+void l1sched_del_all_ts(struct l1sched_state *sched)
+{
+ for (unsigned int tn = 0; tn < ARRAY_SIZE(sched->ts); tn++) {
+ if (sched->ts[tn] == NULL)
+ continue;
+ l1sched_del_ts(sched, tn);
+ }
+}
+
static struct l1sched_lchan_state *
l1sched_ts_add_lchan(struct l1sched_ts *ts,
enum l1sched_lchan_type type)
--
To view, visit https://gerrit.osmocom.org/c/osmocom-bb/+/41905?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmocom-bb
Gerrit-Branch: master
Gerrit-Change-Id: I35ce97459dcd0e2cac4ab8927f02fe0232aa6142
Gerrit-Change-Number: 41905
Gerrit-PatchSet: 2
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>