aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2023-07-07 10:10:24 +0200
committerlaforge <laforge@osmocom.org>2023-07-10 18:06:19 +0000
commit34838ee4e997bdd1706e279e526bba1a57143177 (patch)
tree502604573fd970903b3f95accf66ede76215bbac
parent44c94fdeae11d922d07a8ad2d22b157412f3ae3b (diff)
Change return value of bts_supports_cm() from int to bool
-rw-r--r--include/osmo-bts/bts.h4
-rw-r--r--src/common/bts.c26
-rw-r--r--src/common/rsl.c2
-rw-r--r--tests/misc/misc_test.c14
4 files changed, 23 insertions, 23 deletions
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index 92900890..a21a5df8 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -419,8 +419,8 @@ struct gsm_time *get_time(struct gsm_bts *bts);
int bts_main(int argc, char **argv);
-int bts_supports_cm(const struct gsm_bts *bts,
- const struct rsl_ie_chan_mode *cm);
+bool bts_supports_cm(const struct gsm_bts *bts,
+ const struct rsl_ie_chan_mode *cm);
int32_t bts_get_avg_fn_advance(const struct gsm_bts *bts);
diff --git a/src/common/bts.c b/src/common/bts.c
index 6652ce62..0ca4b6dd 100644
--- a/src/common/bts.c
+++ b/src/common/bts.c
@@ -779,8 +779,8 @@ struct gsm_time *get_time(struct gsm_bts *bts)
return &bts->gsm_time;
}
-int bts_supports_cm(const struct gsm_bts *bts,
- const struct rsl_ie_chan_mode *cm)
+bool bts_supports_cm(const struct gsm_bts *bts,
+ const struct rsl_ie_chan_mode *cm)
{
enum osmo_bts_features feature = _NUM_BTS_FEAT;
@@ -788,22 +788,22 @@ int bts_supports_cm(const struct gsm_bts *bts,
case RSL_CMOD_SPD_SIGN:
/* We assume that signalling support is mandatory,
* there is no BTS_FEAT_* definition to check that. */
- return 1;
+ return true;
case RSL_CMOD_SPD_SPEECH:
break;
case RSL_CMOD_CRT_TCH_GROUP_Bm:
case RSL_CMOD_CRT_TCH_GROUP_Lm:
if (!osmo_bts_has_feature(bts->features, BTS_FEAT_VGCS))
- return 0;
+ return false;
break;
case RSL_CMOD_CRT_TCH_BCAST_Bm:
case RSL_CMOD_CRT_TCH_BCAST_Lm:
if (!osmo_bts_has_feature(bts->features, BTS_FEAT_VBS))
- return 0;
+ return false;
break;
case RSL_CMOD_SPD_DATA:
default:
- return 0;
+ return false;
}
/* Before the requested pchan/cm combination can be checked, we need to
@@ -811,7 +811,7 @@ int bts_supports_cm(const struct gsm_bts *bts,
switch (cm->chan_rt) {
case RSL_CMOD_CRT_OSMO_TCH_VAMOS_Bm:
if (!osmo_bts_has_feature(bts->features, BTS_FEAT_VAMOS))
- return 0;
+ return false;
/* fall-through */
case RSL_CMOD_CRT_TCH_Bm:
case RSL_CMOD_CRT_TCH_GROUP_Bm:
@@ -828,13 +828,13 @@ int bts_supports_cm(const struct gsm_bts *bts,
break;
default:
/* Invalid speech codec type => Not supported! */
- return 0;
+ return false;
}
break;
case RSL_CMOD_CRT_OSMO_TCH_VAMOS_Lm:
if (!osmo_bts_has_feature(bts->features, BTS_FEAT_VAMOS))
- return 0;
+ return false;
/* fall-through */
case RSL_CMOD_CRT_TCH_Lm:
case RSL_CMOD_CRT_TCH_GROUP_Lm:
@@ -848,7 +848,7 @@ int bts_supports_cm(const struct gsm_bts *bts,
break;
default:
/* Invalid speech codec type => Not supported! */
- return 0;
+ return false;
}
break;
@@ -856,14 +856,14 @@ int bts_supports_cm(const struct gsm_bts *bts,
LOGP(DRSL, LOGL_ERROR,
"Unhandled RSL channel type=0x%02x/rate=0x%02x\n",
cm->chan_rt, cm->chan_rate);
- return 0;
+ return false;
}
/* Check if the feature is supported by this BTS */
if (osmo_bts_has_feature(bts->features, feature))
- return 1;
+ return true;
- return 0;
+ return false;
}
/* return the gsm_lchan for the CBCH (if it exists at all) */
diff --git a/src/common/rsl.c b/src/common/rsl.c
index 7bd950f3..df161496 100644
--- a/src/common/rsl.c
+++ b/src/common/rsl.c
@@ -248,7 +248,7 @@ static int rsl_handle_chan_mod_ie(struct gsm_lchan *lchan,
#undef RSL_CMODE
- if (bts_supports_cm(lchan->ts->trx->bts, cm) != 1) {
+ if (!bts_supports_cm(lchan->ts->trx->bts, cm)) {
LOGPLCHAN(lchan, DRSL, LOGL_ERROR, "Channel type=0x%02x/mode=%s "
"is not supported by the PHY\n", cm->chan_rt,
gsm48_chan_mode_name(lchan->tch_mode));
diff --git a/tests/misc/misc_test.c b/tests/misc/misc_test.c
index b1b9820d..cdc57df2 100644
--- a/tests/misc/misc_test.c
+++ b/tests/misc/misc_test.c
@@ -172,11 +172,11 @@ static void test_bts_supports_cm(void)
/* Signalling shall be supported regardless of the features */
cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Bm,
.spd_ind = RSL_CMOD_SPD_SIGN };
- OSMO_ASSERT(bts_supports_cm(bts, &cm) == 1); /* TCH/F */
+ OSMO_ASSERT(bts_supports_cm(bts, &cm) == true); /* TCH/F */
cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Lm,
.spd_ind = RSL_CMOD_SPD_SIGN };
- OSMO_ASSERT(bts_supports_cm(bts, &cm) == 1); /* TCH/H */
+ OSMO_ASSERT(bts_supports_cm(bts, &cm) == true); /* TCH/H */
osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_F_V1);
osmo_bts_set_feature(bts->features, BTS_FEAT_SPEECH_H_V1);
@@ -186,27 +186,27 @@ static void test_bts_supports_cm(void)
cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Bm,
.spd_ind = RSL_CMOD_SPD_SPEECH,
.chan_rate = RSL_CMOD_SP_GSM1 };
- OSMO_ASSERT(bts_supports_cm(bts, &cm) == 1); /* TCH/FS */
+ OSMO_ASSERT(bts_supports_cm(bts, &cm) == true); /* TCH/FS */
cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Lm,
.spd_ind = RSL_CMOD_SPD_SPEECH,
.chan_rate = RSL_CMOD_SP_GSM1 };
- OSMO_ASSERT(bts_supports_cm(bts, &cm) == 1); /* TCH/HS */
+ OSMO_ASSERT(bts_supports_cm(bts, &cm) == true); /* TCH/HS */
cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Bm,
.spd_ind = RSL_CMOD_SPD_SPEECH,
.chan_rate = RSL_CMOD_SP_GSM2 };
- OSMO_ASSERT(bts_supports_cm(bts, &cm) == 0); /* TCH/EFS */
+ OSMO_ASSERT(bts_supports_cm(bts, &cm) == false); /* TCH/EFS */
cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Bm,
.spd_ind = RSL_CMOD_SPD_SPEECH,
.chan_rate = RSL_CMOD_SP_GSM3 };
- OSMO_ASSERT(bts_supports_cm(bts, &cm) == 1); /* TCH/AFS */
+ OSMO_ASSERT(bts_supports_cm(bts, &cm) == true); /* TCH/AFS */
cm = (struct rsl_ie_chan_mode) { .chan_rt = RSL_CMOD_CRT_TCH_Lm,
.spd_ind = RSL_CMOD_SPD_SPEECH,
.chan_rate = RSL_CMOD_SP_GSM3 };
- OSMO_ASSERT(bts_supports_cm(bts, &cm) == 1); /* TCH/AHS */
+ OSMO_ASSERT(bts_supports_cm(bts, &cm) == true); /* TCH/AHS */
talloc_free(bts);
}