aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-10-09 00:46:45 +0700
committerlaforge <laforge@osmocom.org>2020-10-08 20:32:40 +0000
commitc0b544f103e96e08416848ea9c243c64490a6784 (patch)
treed62c010d6e58a43f8cb16969e62b2ceed0b051fa
parent8be3fa6f368c7e12e2ede67fb1e1101ef6eed022 (diff)
pcu_sock: use llist_for_each_entry() in pcu_sock_close()
Using gsm_bts_trx_num() involves redundant iterations over the list of transceivers - we definitely don't want them. Change-Id: I4bd40ffcc1e925412a21b0a934bbfdeddbc6ad1f
-rw-r--r--src/common/pcu_sock.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index 7f7f7cf1..d54e385a 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -883,7 +883,7 @@ static void pcu_sock_close(struct pcu_sock_state *state)
struct gsm_bts *bts;
struct gsm_bts_trx *trx;
struct gsm_bts_trx_ts *ts;
- int i, j;
+ unsigned int tn;
/* FIXME: allow multiple BTS */
bts = llist_entry(state->net->bts_list.next, struct gsm_bts, list);
@@ -910,13 +910,10 @@ static void pcu_sock_close(struct pcu_sock_state *state)
osmo_signal_dispatch(SS_GLOBAL, S_NEW_SYSINFO, bts);
#endif
- /* release PDCH */
- for (i = 0; i < 8; i++) {
- trx = gsm_bts_trx_num(bts, i);
- if (!trx)
- break;
- for (j = 0; j < 8; j++) {
- ts = &trx->ts[j];
+ /* Deactivate all active PDCH timeslots */
+ llist_for_each_entry(trx, &bts->trx_list, list) {
+ for (tn = 0; tn < 8; tn++) {
+ ts = &trx->ts[tn];
if (ts->mo.nm_state.operational == NM_OPSTATE_ENABLED
&& ts->pchan == GSM_PCHAN_PDCH) {
ts->lchan[0].rel_act_kind = LCHAN_REL_ACT_PCU;