aboutsummaryrefslogtreecommitdiffstats
path: root/src/osmo-bsc/abis_om2000.c
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2022-05-04 16:17:04 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2022-05-06 14:50:24 +0200
commitb978d1582f948871709acc6d606fbc3b60f0bf01 (patch)
tree268284e797e17c4322b924dd50acb43ae9cfd81d /src/osmo-bsc/abis_om2000.c
parent7b36d0b0a0d87a80160f6c2398ea7bb7ff0ccd67 (diff)
nm_statechg_signal_data: Convert state ptr to data
There's no need to use pointers there, it is only asking for errors from code handling the data structe from the signal by attempting to change them. Even for mem size point of view it doesn't make sense, since it's 3 byte vs a 4 byte pointer. Furthermore, this is a preparation for new commit, where the NM object current state will be updated before emitting the signal. This patch eases a lot the follow up mentioned patch. Change-Id: I9b648dfd8392b7b40bfe2b38f3345017481f5129
Diffstat (limited to 'src/osmo-bsc/abis_om2000.c')
-rw-r--r--src/osmo-bsc/abis_om2000.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/osmo-bsc/abis_om2000.c b/src/osmo-bsc/abis_om2000.c
index 18d0728a3..04c783b4c 100644
--- a/src/osmo-bsc/abis_om2000.c
+++ b/src/osmo-bsc/abis_om2000.c
@@ -950,13 +950,20 @@ static void *mo2obj(struct gsm_bts *bts, struct abis_om2k_mo *mo)
static void update_mo_state(struct gsm_bts *bts, struct abis_om2k_mo *mo, uint8_t mo_state)
{
struct gsm_nm_state *nm_state = mo2nm_state(bts, mo);
- struct gsm_nm_state new_state;
struct nm_statechg_signal_data nsd;
bool has_enabled_state;
if (!nm_state)
return;
+ memset(&nsd, 0, sizeof(nsd));
+
+ nsd.bts = bts;
+ nsd.obj = mo2obj(bts, mo);
+ nsd.old_state = *nm_state;
+ nsd.new_state = *nm_state;
+ nsd.om2k_mo = mo;
+
switch (mo->class) {
case OM2K_MO_CLS_CF:
case OM2K_MO_CLS_TRXC:
@@ -967,36 +974,27 @@ static void update_mo_state(struct gsm_bts *bts, struct abis_om2k_mo *mo, uint8_
break;
}
- new_state = *nm_state;
switch (mo_state) {
case OM2K_MOSTATE_RESET:
- new_state.availability = NM_AVSTATE_POWER_OFF;
+ nsd.new_state.availability = NM_AVSTATE_POWER_OFF;
break;
case OM2K_MOSTATE_STARTED:
- new_state.availability = has_enabled_state ? NM_AVSTATE_OFF_LINE : NM_AVSTATE_OK;
+ nsd.new_state.availability = has_enabled_state ? NM_AVSTATE_OFF_LINE : NM_AVSTATE_OK;
break;
case OM2K_MOSTATE_ENABLED:
- new_state.availability = NM_AVSTATE_OK;
+ nsd.new_state.availability = NM_AVSTATE_OK;
break;
case OM2K_MOSTATE_DISABLED:
- new_state.availability = NM_AVSTATE_POWER_OFF;
+ nsd.new_state.availability = NM_AVSTATE_POWER_OFF;
break;
default:
- new_state.availability = NM_AVSTATE_DEGRADED;
+ nsd.new_state.availability = NM_AVSTATE_DEGRADED;
break;
}
- memset(&nsd, 0, sizeof(nsd));
-
- nsd.bts = bts;
- nsd.obj = mo2obj(bts, mo);
- nsd.old_state = nm_state;
- nsd.new_state = &new_state;
- nsd.om2k_mo = mo;
-
osmo_signal_dispatch(SS_NM, S_NM_STATECHG, &nsd);
- nm_state->availability = new_state.availability;
+ nm_state->availability = nsd.new_state.availability;
}
static void update_op_state(struct gsm_bts *bts, const struct abis_om2k_mo *mo, uint8_t op_state)