fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmocom-bb/+/34752?usp=email )
Change subject: firmware/layer1: clean up l1s_tch_cmd(): reduce nesting ......................................................................
firmware/layer1: clean up l1s_tch_cmd(): reduce nesting
Change-Id: If4f0bb37cb3e12e09078027461cd5040524e43b2 Related: OS#4396 --- M src/target/firmware/layer1/prim_tch.c 1 file changed, 21 insertions(+), 17 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/52/34752/1
diff --git a/src/target/firmware/layer1/prim_tch.c b/src/target/firmware/layer1/prim_tch.c index 1e3ca75..7d5c1f4 100644 --- a/src/target/firmware/layer1/prim_tch.c +++ b/src/target/firmware/layer1/prim_tch.c @@ -434,7 +434,6 @@ if (traffic_tx_now) { volatile uint16_t *traffic_buf; struct msgb *msg; - const uint8_t *data;
/* Reset play mode */ dsp_api.ndb->d_tch_mode &= ~B_PLAY_UL; @@ -448,30 +447,25 @@
/* Pull Traffic data (if any) */ msg = msgb_dequeue(&l1s.tx_queue[L1S_CHAN_TRAFFIC]); + if (msg == NULL) + goto skip_tx_traffic;
/* Copy actual data, skipping the information block [0,1,2] */ - if (msg) { - data = msg->l2h; - dsp_memcpy_to_api(&traffic_buf[3], data, 33, 1); + dsp_memcpy_to_api(&traffic_buf[3], msgb_l2(msg), 33, 1);
- traffic_buf[0] = (1 << B_BLUD); /* 1st word: Set B_BLU bit. */ - traffic_buf[1] = 0; /* 2nd word: cleared. */ - traffic_buf[2] = 0; /* 3nd word: cleared. */ - } + traffic_buf[0] = (1 << B_BLUD); /* 1st word: Set B_BLU bit. */ + traffic_buf[1] = 0; /* 2nd word: cleared. */ + traffic_buf[2] = 0; /* 3nd word: cleared. */
- if (msg) - dsp_api.ndb->d_tch_mode |= B_PLAY_UL; + dsp_api.ndb->d_tch_mode |= B_PLAY_UL;
/* Indicate completion (FIXME: early but easier this way for now) */ - if (msg) { - last_tx_tch_fn = l1s.next_time.fn; - last_tx_tch_type |= TX_TYPE_TRAFFIC; - l1s_compl_sched(L1_COMPL_TX_TCH); - } + last_tx_tch_fn = l1s.next_time.fn; + last_tx_tch_type |= TX_TYPE_TRAFFIC; + l1s_compl_sched(L1_COMPL_TX_TCH);
/* Free msg now that we're done with it */ - if (msg) - msgb_free(msg); + msgb_free(msg); } skip_tx_traffic: