[PATCH] osmo-bts[master]: Remove code duplication

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Tue Mar 7 17:43:53 UTC 2017


Review at  https://gerrit.osmocom.org/1995

Remove code duplication

Use gsm_bts_trx_num() from OpenBSC instead of static function.

Change-Id: Iba80e7a12c85976981a49a9424db069fc4110373
---
M src/common/pcu_sock.c
1 file changed, 4 insertions(+), 18 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/95/1995/1

diff --git a/src/common/pcu_sock.c b/src/common/pcu_sock.c
index afd880f..85bc880 100644
--- a/src/common/pcu_sock.c
+++ b/src/common/pcu_sock.c
@@ -60,20 +60,6 @@
 
 static int pcu_sock_send(struct gsm_network *net, struct msgb *msg);
 
-
-static struct gsm_bts_trx *trx_by_nr(struct gsm_bts *bts, uint8_t trx_nr)
-{
-	struct gsm_bts_trx *trx;
-
-	llist_for_each_entry(trx, &bts->trx_list, list) {
-		if (trx->nr == trx_nr)
-			return trx;
-	}
-
-	return NULL;
-}
-
-
 /*
  * PCU messages
  */
@@ -223,7 +209,7 @@
 	}
 
 	for (i = 0; i < 8; i++) {
-		trx = trx_by_nr(bts, i);
+		trx = gsm_bts_trx_num(bts, i);
 		if (!trx)
 			break;
 		info_ind->trx[i].pdch_mask = 0;
@@ -531,7 +517,7 @@
 		break;
 	case PCU_IF_SAPI_PDTCH:
 	case PCU_IF_SAPI_PTCCH:
-		trx = trx_by_nr(bts, data_req->trx_nr);
+		trx = gsm_bts_trx_num(bts, data_req->trx_nr);
 		if (!trx) {
 			LOGP(DPCU, LOGL_ERROR, "Received PCU data request with "
 				"not existing TRX %d\n", data_req->trx_nr);
@@ -562,7 +548,7 @@
 		(act_req->activate) ? "Activate" : "Deactivate",
 		act_req->trx_nr, act_req->ts_nr);
 
-	trx = trx_by_nr(bts, act_req->trx_nr);
+	trx = gsm_bts_trx_num(bts, act_req->trx_nr);
 	if (!trx || act_req->ts_nr >= 8)
 		return -EINVAL;
 
@@ -675,7 +661,7 @@
 
 	/* release PDCH */
 	for (i = 0; i < 8; i++) {
-		trx = trx_by_nr(bts, i);
+		trx = gsm_bts_trx_num(bts, i);
 		if (!trx)
 			break;
 		for (j = 0; j < 8; j++) {

-- 
To view, visit https://gerrit.osmocom.org/1995
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba80e7a12c85976981a49a9424db069fc4110373
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list