Review at https://gerrit.osmocom.org/5083
cosmetic: tighten function type signatures * change return type to bool * constify parameters The nm_is_running(), trx_is_usable() and ts_is_usable() always return boolean value and are always used as such anyway. The also do not change their parameters. Change-Id: I6a572fc78371c69f5308edbad0ebe15e143d0505 --- M include/osmocom/bsc/abis_nm.h M include/osmocom/bsc/chan_alloc.h M src/libbsc/abis_nm.c M src/libbsc/chan_alloc.c 4 files changed, 11 insertions(+), 11 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/83/5083/1 diff --git a/include/osmocom/bsc/abis_nm.h b/include/osmocom/bsc/abis_nm.h index b0cb166..18f87cd 100644 --- a/include/osmocom/bsc/abis_nm.h +++ b/include/osmocom/bsc/abis_nm.h @@ -163,7 +163,7 @@ /* Functions calling into other code parts */ bool all_trx_rsl_connected_unlocked(const struct gsm_bts *bts); -int nm_is_running(struct gsm_nm_state *s); +bool nm_is_running(const struct gsm_nm_state *s); int abis_nm_vty_init(void); diff --git a/include/osmocom/bsc/chan_alloc.h b/include/osmocom/bsc/chan_alloc.h index 7388e14..320fa94 100644 --- a/include/osmocom/bsc/chan_alloc.h +++ b/include/osmocom/bsc/chan_alloc.h @@ -49,6 +49,6 @@ void bts_chan_load(struct pchan_load *cl, const struct gsm_bts *bts); void network_chan_load(struct pchan_load *pl, struct gsm_network *net); -int trx_is_usable(struct gsm_bts_trx *trx); +bool trx_is_usable(const struct gsm_bts_trx *trx); #endif /* _CHAN_ALLOC_H */ diff --git a/src/libbsc/abis_nm.c b/src/libbsc/abis_nm.c index 295cefd..f1a56a6 100644 --- a/src/libbsc/abis_nm.c +++ b/src/libbsc/abis_nm.c @@ -159,7 +159,7 @@ static int abis_nm_rcvmsg_sw(struct msgb *mb); -int nm_is_running(struct gsm_nm_state *s) { +bool nm_is_running(const struct gsm_nm_state *s) { return (s->operational == NM_OPSTATE_ENABLED) && ( (s->availability == NM_AVSTATE_OK) || (s->availability == 0xff) diff --git a/src/libbsc/chan_alloc.c b/src/libbsc/chan_alloc.c index f0275bc..4b2531e 100644 --- a/src/libbsc/chan_alloc.c +++ b/src/libbsc/chan_alloc.c @@ -36,41 +36,41 @@ #include <osmocom/core/talloc.h> -static int ts_is_usable(struct gsm_bts_trx_ts *ts) +static bool ts_is_usable(const struct gsm_bts_trx_ts *ts) { /* FIXME: How does this behave for BS-11 ? */ if (is_ipaccess_bts(ts->trx->bts)) { if (!nm_is_running(&ts->mo.nm_state)) - return 0; + return false; } /* If a TCH/F_PDCH TS is busy changing, it is already taken or not * yet available. */ if (ts->pchan == GSM_PCHAN_TCH_F_PDCH) { if (ts->flags & TS_F_PDCH_PENDING_MASK) - return 0; + return false; } /* If a dynamic channel is busy changing, it is already taken or not * yet available. */ if (ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH) { if (ts->dyn.pchan_is != ts->dyn.pchan_want) - return 0; + return false; } - return 1; + return true; } -int trx_is_usable(struct gsm_bts_trx *trx) +bool trx_is_usable(const struct gsm_bts_trx *trx) { /* FIXME: How does this behave for BS-11 ? */ if (is_ipaccess_bts(trx->bts)) { if (!nm_is_running(&trx->mo.nm_state) || !nm_is_running(&trx->bb_transc.mo.nm_state)) - return 0; + return false; } - return 1; + return true; } static struct gsm_lchan * -- To view, visit https://gerrit.osmocom.org/5083 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I6a572fc78371c69f5308edbad0ebe15e143d0505 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Max <msur...@sysmocom.de>