bts: Remove global state and the usage of the gprs_rlcmac_bts

Global state makes mocking/writing tests more difficult. Continue
by removing direct usage of the bts and adding it as pointer to
the function calls (showing the true dependencies of the functions)
diff --git a/src/gprs_rlcmac.cpp b/src/gprs_rlcmac.cpp
index 6dea7c8..f0d58d9 100644
--- a/src/gprs_rlcmac.cpp
+++ b/src/gprs_rlcmac.cpp
@@ -188,10 +188,10 @@
 
 LLIST_HEAD(gprs_rlcmac_sbas);
 
-int sba_alloc(uint8_t *_trx, uint8_t *_ts, uint32_t *_fn, uint8_t ta)
+int sba_alloc(struct gprs_rlcmac_bts *bts,
+		uint8_t *_trx, uint8_t *_ts, uint32_t *_fn, uint8_t ta)
 {
 
-	struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
 	struct gprs_rlcmac_pdch *pdch;
 	struct gprs_rlcmac_sba *sba;
 	uint8_t trx, ts;
diff --git a/src/gprs_rlcmac.h b/src/gprs_rlcmac.h
index 8863af4..b8afdcd 100644
--- a/src/gprs_rlcmac.h
+++ b/src/gprs_rlcmac.h
@@ -146,7 +146,7 @@
 
 int gprs_rlcmac_dl_bw(struct gprs_rlcmac_tbf *tbf, uint16_t octets);
 
-int sba_alloc(uint8_t *_trx, uint8_t *_ts, uint32_t *_fn, uint8_t ta);
+int sba_alloc(struct gprs_rlcmac_bts *bts, uint8_t *_trx, uint8_t *_ts, uint32_t *_fn, uint8_t ta);
 
 struct gprs_rlcmac_sba *sba_find(uint8_t trx, uint8_t ts, uint32_t fn);
 
diff --git a/src/gprs_rlcmac_data.cpp b/src/gprs_rlcmac_data.cpp
index 079af56..c2ed9e6 100644
--- a/src/gprs_rlcmac_data.cpp
+++ b/src/gprs_rlcmac_data.cpp
@@ -1060,7 +1060,7 @@
 	if (qta > 252)
 		qta = 252;
 	if (sb) {
-		rc = sba_alloc(&trx, &ts, &sb_fn, qta >> 2);
+		rc = sba_alloc(bts, &trx, &ts, &sb_fn, qta >> 2);
 		if (rc < 0)
 			return rc;
 		LOGP(DRLCMAC, LOGL_DEBUG, "RX: [PCU <- BTS] RACH qbit-ta=%d "
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 9afa85d..6ba117e 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -243,12 +243,11 @@
 
 static void tbf_unlink_pdch(struct gprs_rlcmac_tbf *tbf)
 {
-	struct gprs_rlcmac_bts *bts = gprs_rlcmac_bts;
 	struct gprs_rlcmac_pdch *pdch;
 	int ts;
 
 	if (tbf->direction == GPRS_RLCMAC_UL_TBF) {
-		bts->trx[tbf->trx_no].ul_tbf[tbf->tfi] = NULL;
+		tbf->trx->ul_tbf[tbf->tfi] = NULL;
 		for (ts = 0; ts < 8; ts++) {
 			pdch = tbf->pdch[ts];
 			if (pdch)
@@ -256,7 +255,7 @@
 			tbf->pdch[ts] = NULL;
 		}
 	} else {
-		bts->trx[tbf->trx_no].dl_tbf[tbf->tfi] = NULL;
+		tbf->trx->dl_tbf[tbf->tfi] = NULL;
 		for (ts = 0; ts < 8; ts++) {
 			pdch = tbf->pdch[ts];
 			if (pdch)