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
This commit is contained in:
Pau Espin 2022-08-08 15:32:33 +02:00 committed by pespin
parent 3d0fbe387f
commit ba62898cd8
3 changed files with 13 additions and 8 deletions

View File

@ -356,6 +356,8 @@ struct gsm_lchan {
#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);

View File

@ -108,14 +108,8 @@ struct gsm_bts_trx *gsm_bts_trx_alloc(struct gsm_bts *bts)
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);
}
}

View File

@ -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;