summaryrefslogtreecommitdiffstats
path: root/src/target/firmware
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-10-13 20:57:49 +0700
committerVadim Yanitskiy <vyanitskiy@sysmocom.de>2023-10-16 12:21:40 +0700
commit8a2422db1fcf5992146ca570ea69484226a141ff (patch)
tree3e7d94066b6bdf187647517fb950280380c5ce7b /src/target/firmware
parent79baca14d41663b1282655620328452944a13f4d (diff)
firmware/layer1: clean up l1s_tch_cmd(): reduce nesting
Diffstat (limited to 'src/target/firmware')
-rw-r--r--src/target/firmware/layer1/prim_tch.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/src/target/firmware/layer1/prim_tch.c b/src/target/firmware/layer1/prim_tch.c
index 1e3ca752..7d5c1f46 100644
--- a/src/target/firmware/layer1/prim_tch.c
+++ b/src/target/firmware/layer1/prim_tch.c
@@ -434,7 +434,6 @@ static int l1s_tch_cmd(__unused uint8_t p1, __unused uint8_t p2, uint16_t p3)
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 @@ static int l1s_tch_cmd(__unused uint8_t p1, __unused uint8_t p2, uint16_t p3)
/* 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: