neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31612 )
Change subject: cosmetic: clarify test_codec_support_bts() ......................................................................
cosmetic: clarify test_codec_support_bts()
Change-Id: I13d9b158d08f4938c5aa47ef3134819a4b1f7d29 --- M src/osmo-bsc/codec_pref.c 1 file changed, 28 insertions(+), 20 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/12/31612/1
diff --git a/src/osmo-bsc/codec_pref.c b/src/osmo-bsc/codec_pref.c index dc29a5a..8fd5380 100644 --- a/src/osmo-bsc/codec_pref.c +++ b/src/osmo-bsc/codec_pref.c @@ -194,14 +194,22 @@ llist_for_each_entry(trx, &bts->trx_list, list) { for (i = 0; i < TRX_NR_TS; i++) { pchan = trx->ts[i].pchan_from_config; - if (pchan == GSM_PCHAN_OSMO_DYN) + switch (pchan) { + case GSM_PCHAN_OSMO_DYN: rate_match = true; - else if (full_rate && pchan == GSM_PCHAN_TCH_F) - rate_match = true; - else if (full_rate && pchan == GSM_PCHAN_TCH_F_PDCH) - rate_match = true; - else if (!full_rate && pchan == GSM_PCHAN_TCH_H) - rate_match = true; + break; + case GSM_PCHAN_TCH_F: + case GSM_PCHAN_TCH_F_PDCH: + if (full_rate) + rate_match = true; + break; + case GSM_PCHAN_TCH_H: + if (!full_rate) + rate_match = true; + break; + default: + break; + } } } if (!rate_match) @@ -214,21 +222,12 @@ * selectively disable GSM-RF per BTS via VTY. */ return true; case GSM0808_PERM_FR2: - if (bts_codec->efr) - return true; - break; + return (bool)bts_codec->efr; case GSM0808_PERM_FR3: - if (bts_codec->amr) - return true; - break; - case GSM0808_PERM_HR1: - if (bts_codec->hr) - return true; - break; case GSM0808_PERM_HR3: - if (bts_codec->amr) - return true; - break; + return (bool)bts_codec->amr; + case GSM0808_PERM_HR1: + return (bool)bts_codec->hr; default: return false; }