[6/7] TRX: scheduler: Remove dependency to trx_if.[ch]
diff mbox

Message ID 1454523846-13022-6-git-send-email-laforge@gnumonks.org
State Superseded
Headers show

Commit Message

Harald Welte Feb. 3, 2016, 6:24 p.m. UTC
From: Harald Welte <laforge@gnumonks.org>

---
 src/osmo-bts-trx/scheduler.c         | 14 +++-----------
 src/osmo-bts-trx/scheduler_backend.h |  1 +
 src/osmo-bts-trx/scheduler_trx.c     | 10 ++++++++++
 3 files changed, 14 insertions(+), 11 deletions(-)

Patch
diff mbox

diff --git a/src/osmo-bts-trx/scheduler.c b/src/osmo-bts-trx/scheduler.c
index 10f8972..dee46ed 100644
--- a/src/osmo-bts-trx/scheduler.c
+++ b/src/osmo-bts-trx/scheduler.c
@@ -38,7 +38,6 @@ 
 
 #include "scheduler.h"
 #include "scheduler_backend.h"
-//#include "trx_if.h"
 
 extern void *tall_bts_ctx;
 
@@ -1325,10 +1324,8 @@  int trx_sched_set_lchan(struct l1sched_trx *l1t, uint8_t chan_nr, uint8_t link_i
 	}
 
 	/* disable handover detection (on deactivation) */
-	if (!active) {
-		struct trx_l1h *l1h = trx_l1h_hdl(l1t->trx);
-		trx_if_cmd_nohandover(l1h, tn, ss);
-	}
+	if (!active)
+		_sched_act_rach_det(l1t, tn, ss, 0);
 
 	return rc;
 }
@@ -1340,7 +1337,6 @@  int trx_sched_set_mode(struct l1sched_trx *l1t, uint8_t chan_nr, uint8_t rsl_cmo
 {
 	uint8_t tn = L1SAP_CHAN2TS(chan_nr);
 	struct l1sched_ts *l1ts = l1sched_trx_get_ts(l1t, tn);
-	struct trx_l1h *l1h = trx_l1h_hdl(l1t->trx);
 	uint8_t ss = l1sap_chan2ss(chan_nr);
 	int i;
 	int rc = -EINVAL;
@@ -1385,11 +1381,7 @@  int trx_sched_set_mode(struct l1sched_trx *l1t, uint8_t chan_nr, uint8_t rsl_cmo
 	 * of transceiver link).
 	 * disable handover, if state is still set, since we might not know
 	 * the actual state of transceiver (due to loss of link) */
-	if (handover) {
-		trx_if_cmd_handover(l1h, tn, ss);
-	} else {
-		trx_if_cmd_nohandover(l1h, tn, ss);
-	}
+	_sched_act_rach_det(l1t, tn, ss, handover);
 
 	return rc;
 }
diff --git a/src/osmo-bts-trx/scheduler_backend.h b/src/osmo-bts-trx/scheduler_backend.h
index b808455..9f663cd 100644
--- a/src/osmo-bts-trx/scheduler_backend.h
+++ b/src/osmo-bts-trx/scheduler_backend.h
@@ -79,3 +79,4 @@  int rx_tchh_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
 
 const ubit_t *_sched_dl_burst(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn);
 int _sched_rts(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn);
+void _sched_act_rach_det(struct l1sched_trx *l1t, uint8_t tn, uint8_t ss, int activate);
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 0aeb835..5629a64 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -1458,3 +1458,13 @@  new_clock:
 
 	return 0;
 }
+
+void _sched_act_rach_det(struct l1sched_trx *l1t, uint8_t tn, uint8_t ss, int activate)
+{
+	struct trx_l1h *l1h = trx_l1h_hdl(l1t->trx);
+
+	if (activate)
+		trx_if_cmd_handover(l1h, tn, ss);
+	else
+		trx_if_cmd_nohandover(l1h, tn, ss);
+}