prepare dyn TS: act lchan: fetch the channel mode a bit later

Dyn TS will add a new type of chan activation, which does not need a Channel
Mode IE. Incidentally, the dyn PDCH also doesn't need this IE if it opts for
sending a PDCH ACT instead. So it makes sense to compose the Channel Mode IE
only after the dynamic decisions are done.

Change-Id: I66d88ad6a4ae7bee1e552960fd4e92aff953125c
diff --git a/openbsc/src/libbsc/abis_rsl.c b/openbsc/src/libbsc/abis_rsl.c
index e50e332..b75c3f3 100644
--- a/openbsc/src/libbsc/abis_rsl.c
+++ b/openbsc/src/libbsc/abis_rsl.c
@@ -446,14 +446,6 @@
 	struct rsl_ie_chan_mode cm;
 	struct gsm48_chan_desc cd;
 
-	rc = channel_mode_from_lchan(&cm, lchan);
-	if (rc < 0) {
-		LOGP(DRSL, LOGL_ERROR,
-		     "%s Cannot find channel mode from lchan type\n",
-		     gsm_ts_and_pchan_name(lchan->ts));
-		return rc;
-	}
-
 	/* If a TCH_F/PDCH TS is in PDCH mode, deactivate PDCH first. */
 	if (lchan->ts->pchan == GSM_PCHAN_TCH_F_PDCH
 	    && (lchan->ts->flags & TS_F_PDCH_ACTIVE)) {
@@ -463,6 +455,14 @@
 		return rsl_ipacc_pdch_activate(lchan->ts, 0);
 	}
 
+	rc = channel_mode_from_lchan(&cm, lchan);
+	if (rc < 0) {
+		LOGP(DRSL, LOGL_ERROR,
+		     "%s Cannot find channel mode from lchan type\n",
+		     gsm_ts_and_pchan_name(lchan->ts));
+		return rc;
+	}
+
 	rsl_lchan_set_state(lchan, LCHAN_S_ACT_REQ);
 
 	ta = lchan->rqd_ta;