summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/core/fsm.h7
-rw-r--r--src/fsm.c15
-rw-r--r--tests/fsm/fsm_test.err2
3 files changed, 12 insertions, 12 deletions
diff --git a/include/osmocom/core/fsm.h b/include/osmocom/core/fsm.h
index fba5497b..026ed01a 100644
--- a/include/osmocom/core/fsm.h
+++ b/include/osmocom/core/fsm.h
@@ -110,11 +110,14 @@ struct osmo_fsm_inst {
void osmo_fsm_log_addr(bool log_addr);
-#define LOGPFSM(fi, fmt, args...) \
- LOGP((fi)->fsm->log_subsys, (fi)->log_level, "%s{%s}: " fmt, \
+#define LOGPFSML(fi, level, fmt, args...) \
+ LOGP((fi)->fsm->log_subsys, level, "%s{%s}: " fmt, \
osmo_fsm_inst_name(fi), \
osmo_fsm_state_name((fi)->fsm, (fi)->state), ## args)
+#define LOGPFSM(fi, fmt, args...) \
+ LOGPFSML(fi, (fi)->log_level, fmt, ## args)
+
int osmo_fsm_register(struct osmo_fsm *fsm);
void osmo_fsm_unregister(struct osmo_fsm *fsm);
struct osmo_fsm_inst *osmo_fsm_inst_alloc(struct osmo_fsm *fsm, void *ctx, void *priv,
diff --git a/src/fsm.c b/src/fsm.c
index 9dc6b987..1db39f75 100644
--- a/src/fsm.c
+++ b/src/fsm.c
@@ -311,11 +311,9 @@ int osmo_fsm_inst_state_chg(struct osmo_fsm_inst *fi, uint32_t new_state,
/* validate if new_state is a valid state */
if (!(st->out_state_mask & (1 << new_state))) {
- LOGP(fsm->log_subsys, LOGL_ERROR, "%s(%s): transition to "
- "state %s not permitted!\n",
- osmo_fsm_inst_name(fi),
- osmo_fsm_state_name(fsm, fi->state),
- osmo_fsm_state_name(fsm, new_state));
+ LOGPFSML(fi, LOGL_ERROR,
+ "transition to state %s not permitted!\n",
+ osmo_fsm_state_name(fsm, new_state));
return -EPERM;
}
@@ -376,10 +374,9 @@ int osmo_fsm_inst_dispatch(struct osmo_fsm_inst *fi, uint32_t event, void *data)
}
if (!((1 << event) & fs->in_event_mask)) {
- LOGP(fsm->log_subsys, LOGL_ERROR, "%s(%s): Event %s not "
- "permitted\n", osmo_fsm_inst_name(fi),
- osmo_fsm_state_name(fsm, fi->state),
- osmo_fsm_event_name(fsm, event));
+ LOGPFSML(fi, LOGL_ERROR,
+ "Event %s not permitted\n",
+ osmo_fsm_event_name(fsm, event));
return -1;
}
fs->action(fi, event, data);
diff --git a/tests/fsm/fsm_test.err b/tests/fsm/fsm_test.err
index b9c738c6..c9021bbd 100644
--- a/tests/fsm/fsm_test.err
+++ b/tests/fsm/fsm_test.err
@@ -1,7 +1,7 @@
Checking FSM allocation
Test FSM{NULL}: Allocated
Test FSM{NULL}: Received Event 1
-Test FSM(NULL): Event 1 not permitted
+Test FSM{NULL}: Event 1 not permitted
Test FSM{NULL}: Received Event 0
Test FSM{NULL}: state_chg to ONE
Test FSM{ONE}: Received Event 1