From d0ff694cb94e350b240120e75e19ab4fd31cbe7f Mon Sep 17 00:00:00 2001 From: Max Date: Wed, 29 Nov 2017 12:45:34 +0100 Subject: [PATCH] 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 --- include/osmocom/bsc/abis_nm.h | 2 +- include/osmocom/bsc/chan_alloc.h | 2 +- src/libbsc/abis_nm.c | 2 +- src/libbsc/chan_alloc.c | 16 ++++++++-------- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/osmocom/bsc/abis_nm.h b/include/osmocom/bsc/abis_nm.h index b0cb16669..18f87cdf4 100644 --- a/include/osmocom/bsc/abis_nm.h +++ b/include/osmocom/bsc/abis_nm.h @@ -163,7 +163,7 @@ const char *ipacc_testres_name(uint8_t res); /* 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 7388e14c5..320fa947c 100644 --- a/include/osmocom/bsc/chan_alloc.h +++ b/include/osmocom/bsc/chan_alloc.h @@ -49,6 +49,6 @@ struct pchan_load { 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 295cefde2..f1a56a611 100644 --- a/src/libbsc/abis_nm.c +++ b/src/libbsc/abis_nm.c @@ -159,7 +159,7 @@ static int abis_nm_sendmsg_direct(struct gsm_bts *bts, struct msgb *msg) 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 f0275bc96..4b2531eac 100644 --- a/src/libbsc/chan_alloc.c +++ b/src/libbsc/chan_alloc.c @@ -36,41 +36,41 @@ #include -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 *