dyn TS, assignment: allow switch from PDCH with associated conn

Typically, an lchan that is released should no longer be associated with
subscriber connection. If that is the case, an S_LCHAN_UNEXPECTED_RELEASE is
triggered, which aborts, e.g., an ongoing assignment.

However, with dynamic timeslots, we may set lchan->conn and then start to
switch over from PDCH to a TCH mode, in which case it is perfectly fine to
release an lchan that is associated to a conn.

In lchan_free(), do not fire S_LCHAN_UNEXPECTED_RELEASE for a dyn TS that is
currently in switchover.

This is the second and last part to fix dynamic timeslots handling of the
gscon.

Related: OS#3211
Change-Id: Id7d9dd06451722eb328db77bb586826c954bd85c
diff --git a/src/libbsc/chan_alloc.c b/src/libbsc/chan_alloc.c
index e72ab3c..9668968 100644
--- a/src/libbsc/chan_alloc.c
+++ b/src/libbsc/chan_alloc.c
@@ -448,7 +448,9 @@
 	lchan->type = GSM_LCHAN_NONE;
 
 
-	if (lchan->conn) {
+	if (lchan->conn
+	    && !(lchan->ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH
+		 && lchan->ts->dyn.pchan_is != lchan->ts->dyn.pchan_want)) {
 		struct lchan_signal_data sig;
 
 		/* We might kill an active channel... */
@@ -479,7 +481,9 @@
 	sig.bts = lchan->ts->trx->bts;
 	osmo_signal_dispatch(SS_CHALLOC, S_CHALLOC_FREED, &sig);
 
-	if (lchan->conn) {
+	if (lchan->conn
+	    && !(lchan->ts->pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH
+		 && lchan->ts->dyn.pchan_is != lchan->ts->dyn.pchan_want)) {
 		LOGP(DRLL, LOGL_ERROR, "the subscriber connection should be gone.\n");
 		lchan->conn = NULL;
 	}