<p>pespin <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/25708">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  osmith: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved; Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Move ts_fsm_init to static constructor [3/4]<br><br>This allows having it initialized automatically, as we usually do with<br>this type of code. As a result, tests or other apps importing libbsc<br>don't need to take care of calling it.<br><br>NOTE: This fix is required by follow-up patches where some stubs are removed<br>and hence some tests start using FSMs internally. Since tests were not<br>using those FSMs before, there was no need to call ts_fsm_init().<br><br>This is one further step towards fixing interdependency mess of symbols<br>and stubs.<br><br>Change-Id: I0e4b95b5e73fbb3844d83ba33e66786831088e1f<br>---<br>M include/osmocom/bsc/timeslot_fsm.h<br>M src/osmo-bsc/osmo_bsc_main.c<br>M src/osmo-bsc/timeslot_fsm.c<br>M tests/handover/handover_test.c<br>4 files changed, 1 insertion(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/bsc/timeslot_fsm.h b/include/osmocom/bsc/timeslot_fsm.h</span><br><span>index 1831537..5e62188 100644</span><br><span>--- a/include/osmocom/bsc/timeslot_fsm.h</span><br><span>+++ b/include/osmocom/bsc/timeslot_fsm.h</span><br><span>@@ -42,8 +42,6 @@</span><br><span>         TS_EV_PDCH_DEACT_NACK,</span><br><span> };</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-void ts_fsm_init();</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> void ts_fsm_alloc(struct gsm_bts_trx_ts *ts);</span><br><span> void ts_fsm_free(struct gsm_bts_trx_ts *ts);</span><br><span> </span><br><span>diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c</span><br><span>index 8d6901d..e8a22fe 100644</span><br><span>--- a/src/osmo-bsc/osmo_bsc_main.c</span><br><span>+++ b/src/osmo-bsc/osmo_bsc_main.c</span><br><span>@@ -979,7 +979,6 @@</span><br><span>     /* seed the PRNG */</span><br><span>  srand(time(NULL));</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-  ts_fsm_init();</span><br><span>       lchan_fsm_init();</span><br><span>    bsc_subscr_conn_fsm_init();</span><br><span>  assignment_fsm_init();</span><br><span>diff --git a/src/osmo-bsc/timeslot_fsm.c b/src/osmo-bsc/timeslot_fsm.c</span><br><span>index 8d256bb..76ac1af 100644</span><br><span>--- a/src/osmo-bsc/timeslot_fsm.c</span><br><span>+++ b/src/osmo-bsc/timeslot_fsm.c</span><br><span>@@ -52,7 +52,7 @@</span><br><span>                            gsm_pchan_id(ts->pchan_on_init));</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-void ts_fsm_init()</span><br><span style="color: hsl(120, 100%, 40%);">+static __attribute__((constructor)) void ts_fsm_init(void)</span><br><span> {</span><br><span>   OSMO_ASSERT(osmo_fsm_register(&ts_fsm) == 0);</span><br><span> }</span><br><span>diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c</span><br><span>index bd65b2f..1dc7c1f 100644</span><br><span>--- a/tests/handover/handover_test.c</span><br><span>+++ b/tests/handover/handover_test.c</span><br><span>@@ -1626,7 +1626,6 @@</span><br><span>  bsc_vty_init(bsc_gsmnet);</span><br><span>    ho_test_vty_init();</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ts_fsm_init();</span><br><span>       lchan_fsm_init();</span><br><span>    bsc_subscr_conn_fsm_init();</span><br><span>  handover_fsm_init();</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/25708">change 25708</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-bsc/+/25708"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I0e4b95b5e73fbb3844d83ba33e66786831088e1f </div>
<div style="display:none"> Gerrit-Change-Number: 25708 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: dexter <pmaier@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: osmith <osmith@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>