This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
fixeria gerrit-no-reply at lists.osmocom.orgfixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/24485 ) Change subject: [VAMOS] conf_lchans_as_pchan(): improve readability ...................................................................... [VAMOS] conf_lchans_as_pchan(): improve readability Change-Id: I1c5a033e89d9ca5fb01ebe9ffb521fd67d159bee --- M src/common/oml.c 1 file changed, 18 insertions(+), 31 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/85/24485/1 diff --git a/src/common/oml.c b/src/common/oml.c index cf83903..d31bacd 100644 --- a/src/common/oml.c +++ b/src/common/oml.c @@ -816,59 +816,46 @@ int conf_lchans_as_pchan(struct gsm_bts_trx_ts *ts, enum gsm_phys_chan_config pchan) { - struct gsm_lchan *lchan; unsigned int i; +#define lchans_type_set(ts, ltype, num) do { \ + for (i = 0; i < num; i++) \ + (ts)->lchan[i].type = ltype; \ + } while(0) + switch (pchan) { case GSM_PCHAN_CCCH_SDCCH4_CBCH: - /* fallthrough */ case GSM_PCHAN_CCCH_SDCCH4: - for (i = 0; i < 4; i++) { - lchan = &ts->lchan[i]; - if (pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH - && i == 2) { - lchan->type = GSM_LCHAN_CBCH; - } else { - lchan->type = GSM_LCHAN_SDCCH; - } - } + lchans_type_set(ts, GSM_LCHAN_SDCCH, 4); + if (pchan == GSM_PCHAN_CCCH_SDCCH4_CBCH) + ts->lchan[2].type = GSM_LCHAN_CBCH; /* fallthrough */ case GSM_PCHAN_CCCH: - lchan = &ts->lchan[CCCH_LCHAN]; - lchan->type = GSM_LCHAN_CCCH; + ts->lchan[CCCH_LCHAN].type = GSM_LCHAN_CBCH; break; case GSM_PCHAN_TCH_F: - lchan = &ts->lchan[0]; - lchan->type = GSM_LCHAN_TCH_F; + lchans_type_set(ts, GSM_LCHAN_TCH_F, 1); break; case GSM_PCHAN_TCH_H: - for (i = 0; i < 2; i++) { - lchan = &ts->lchan[i]; - lchan->type = GSM_LCHAN_TCH_H; - } + lchans_type_set(ts, GSM_LCHAN_TCH_H, 2); break; case GSM_PCHAN_SDCCH8_SACCH8C_CBCH: - /* fallthrough */ case GSM_PCHAN_SDCCH8_SACCH8C: - for (i = 0; i < 8; i++) { - lchan = &ts->lchan[i]; - if (pchan == GSM_PCHAN_SDCCH8_SACCH8C_CBCH - && i == 2) { - lchan->type = GSM_LCHAN_CBCH; - } else { - lchan->type = GSM_LCHAN_SDCCH; - } - } + lchans_type_set(ts, GSM_LCHAN_SDCCH, 8); + if (pchan == GSM_PCHAN_SDCCH8_SACCH8C_CBCH) + ts->lchan[2].type = GSM_LCHAN_CBCH; break; case GSM_PCHAN_PDCH: - lchan = &ts->lchan[0]; - lchan->type = GSM_LCHAN_PDTCH; + lchans_type_set(ts, GSM_LCHAN_PDTCH, 1); break; default: LOGP(DOML, LOGL_ERROR, "Unknown/unhandled PCHAN type: %u %s\n", ts->pchan, gsm_pchan_name(ts->pchan)); return -NM_NACK_PARAM_RANGE; } + +#undef lchans_type_set + return 0; } -- To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/24485 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Change-Id: I1c5a033e89d9ca5fb01ebe9ffb521fd67d159bee Gerrit-Change-Number: 24485 Gerrit-PatchSet: 1 Gerrit-Owner: fixeria <vyanitskiy at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210601/0d52128d/attachment.htm>