pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/28980 )
Change subject: lchan: Move init logic to a specific function ......................................................................
lchan: Move init logic to a specific function
This way it is a lot easier to find out how and when is an lchan initialized, simply by looking at the lchan.h header, then seeing the init function and grepping for it.
Change-Id: I043d1c2ee75d4d2a8b323b7960ee490e567f3865 --- M include/osmocom/bsc/lchan.h M src/osmo-bsc/bts_trx.c M src/osmo-bsc/lchan.c 3 files changed, 13 insertions(+), 8 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/80/28980/1
diff --git a/include/osmocom/bsc/lchan.h b/include/osmocom/bsc/lchan.h index 4a4634c..a6048c2 100644 --- a/include/osmocom/bsc/lchan.h +++ b/include/osmocom/bsc/lchan.h @@ -356,6 +356,8 @@
#define GSM_LCHAN_SI(lchan, i) (void *)((lchan)->si.buf[i][0])
+void lchan_init(struct gsm_lchan *lchan, struct gsm_bts_trx_ts *ts, unsigned int nr); + void lchan_update_name(struct gsm_lchan *lchan); uint64_t gsm_lchan_active_duration_ms(const struct gsm_lchan *lchan);
diff --git a/src/osmo-bsc/bts_trx.c b/src/osmo-bsc/bts_trx.c index 2202347..ad41100 100644 --- a/src/osmo-bsc/bts_trx.c +++ b/src/osmo-bsc/bts_trx.c @@ -108,14 +108,8 @@ ts->hopping.ma.data = ts->hopping.ma_data;
for (l = 0; l < TS_MAX_LCHAN; l++) { - struct gsm_lchan *lchan; - lchan = &ts->lchan[l]; - - lchan->ts = ts; - lchan->nr = l; - lchan->type = GSM_LCHAN_NONE; - - lchan_update_name(lchan); + struct gsm_lchan *lchan = &ts->lchan[l]; + lchan_init(lchan, ts, l); } }
diff --git a/src/osmo-bsc/lchan.c b/src/osmo-bsc/lchan.c index 84fc97a..262e2a5 100644 --- a/src/osmo-bsc/lchan.c +++ b/src/osmo-bsc/lchan.c @@ -31,6 +31,15 @@ #include <osmocom/bsc/bts_trx.h> #include <osmocom/bsc/abis_rsl.h>
+void lchan_init(struct gsm_lchan *lchan, struct gsm_bts_trx_ts *ts, unsigned int nr) +{ + lchan->ts = ts; + lchan->nr = nr; + lchan->type = GSM_LCHAN_NONE; + + lchan_update_name(lchan); +} + void lchan_update_name(struct gsm_lchan *lchan) { struct gsm_bts_trx_ts *ts = lchan->ts;