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
This commit is contained in:
Max 2017-11-29 12:45:34 +01:00
parent 8c209c9e2b
commit d0ff694cb9
4 changed files with 11 additions and 11 deletions

View File

@ -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);

View File

@ -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 */

View File

@ -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)

View File

@ -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 *