diff mbox

[22/33] l1sap: Use {data, empty}_req_from_l1sap() and avoid code duplication

Message ID 1409176492-13269-23-git-send-email-laforge@gnumonks.org
State Superseded
Headers show

Commit Message

Harald Welte Aug. 27, 2014, 9:54 p.m. UTC
---
 src/osmo-bts-sysmo/l1_if.c | 25 ++++---------------------
 1 file changed, 4 insertions(+), 21 deletions(-)
diff mbox

Patch

diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 5f7b8cf..3b5e823 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -586,29 +586,12 @@  static int ph_tch_req(struct gsm_bts_trx *trx, struct msgb *msg,
 	/* if we provide data, or if data is already in nmsg */
 	if (l1p->u.phDataReq.msgUnitParam.u8Size) {
 		/* data request */
-		GsmL1_PhDataReq_t *data_req = &l1p->u.phDataReq;
-
-		l1p->id = GsmL1_PrimId_PhDataReq;
-
-		data_req->hLayer1 = fl1->hLayer1;
-		data_req->u8Tn = u8Tn;
-		data_req->u32Fn = u32Fn;
-		data_req->sapi = sapi;
-		data_req->subCh = subCh;
-		data_req->u8BlockNbr = u8BlockNbr;
+		data_req_from_l1sap(l1p, fl1, u8Tn, u32Fn, sapi, subCh,
+				    u8BlockNbr,
+				    l1p->u.phDataReq.msgUnitParam.u8Size);
 	} else {
 		/* empty frame */
-		GsmL1_PhEmptyFrameReq_t *empty_req =
-						&l1p->u.phEmptyFrameReq;
-
-		l1p->id = GsmL1_PrimId_PhEmptyFrameReq;
-
-		empty_req->hLayer1 = fl1->hLayer1;
-		empty_req->u8Tn = u8Tn;
-		empty_req->u32Fn = u32Fn;
-		empty_req->sapi = sapi;
-		empty_req->subCh = subCh;
-		empty_req->u8BlockNbr = u8BlockNbr;
+		empty_req_from_l1sap(l1p, fl1, u8Tn, u32Fn, sapi, subCh, u8BlockNbr);
 	}
 	/* send message to DSP's queue */
 	osmo_wqueue_enqueue(&fl1->write_q[MQ_L1_WRITE], nmsg);