fsm: allow graceful exit on FSM termination

The function _osmo_fsm_inst_term() terminates all child FSMs befor
it calls fi->fsm_cleanup(). This prevents the cleanup callback to
perform last actions on the child FSMs (e.g.
osmo_fsm_inst_unlink_parent()).

- Since moving the cleanup callack to the beginning of the function
  would alter the termination behavior and possibly cause malfunction
  in already existing implementation that use OSMO fsm, a new
  optional callback that is called immediately at the beginning of
  the terminatopn process is added.

Change-Id: I0fdda9fe994753f975a658c0f3fb3615949cc8bb
Closes: OS#2915
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 782ba19..928b18d 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -10,3 +10,4 @@
 core		msgb_queue_free()	add inline func to msgb.h
 coding		gsm0503_rach_ext-encode()	add func to gsm0503_coding.h
 codec		ecu.c / ecu.h			implement ECU for FR (Error Concealment Unit)
+fsm		fsmc / fsm.h			added callback for graceful exit => ABI changed
\ No newline at end of file