fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmocom-bb/+/28665 )
Change subject: trxcon: use 'unsigned int tn' for timeslot number ......................................................................
trxcon: use 'unsigned int tn' for timeslot number
Timeslot Number can never be negative, so let's use unsigned. Rename the counter to 'tn' for consistency with other projects.
Change-Id: I93b5a91341e7f79ced0591e13250632ba5e5adef --- M src/host/trxcon/src/l1ctl.c M src/host/trxcon/src/sched_trx.c 2 files changed, 19 insertions(+), 19 deletions(-)
Approvals: Jenkins Builder: Verified osmith: Looks good to me, but someone else must approve fixeria: Looks good to me, approved
diff --git a/src/host/trxcon/src/l1ctl.c b/src/host/trxcon/src/l1ctl.c index b279a53..5475290 100644 --- a/src/host/trxcon/src/l1ctl.c +++ b/src/host/trxcon/src/l1ctl.c @@ -757,7 +757,7 @@ struct l1ctl_tch_mode_req *req; struct l1sched_lchan_state *lchan; struct l1sched_ts *ts; - int i; + unsigned int tn;
req = (struct l1ctl_tch_mode_req *) msg->l1h;
@@ -765,9 +765,9 @@ "(tch_mode=%u, audio_mode=%u)\n", req->tch_mode, req->audio_mode);
/* Iterate over timeslot list */ - for (i = 0; i < ARRAY_SIZE(l1l->sched->ts); i++) { + for (tn = 0; tn < ARRAY_SIZE(l1l->sched->ts); tn++) { /* Timeslot is not allocated */ - ts = l1l->sched->ts[i]; + ts = l1l->sched->ts[tn]; if (ts == NULL) continue;
diff --git a/src/host/trxcon/src/sched_trx.c b/src/host/trxcon/src/sched_trx.c index 964c72f..d3a0a54 100644 --- a/src/host/trxcon/src/sched_trx.c +++ b/src/host/trxcon/src/sched_trx.c @@ -61,7 +61,7 @@ enum l1sched_lchan_type chan; uint8_t offset; struct l1sched_ts *ts; - int i; + unsigned int tn;
/* Advance TDMA frame number in order to give the transceiver * more time to handle the burst before the actual transmission. */ @@ -69,16 +69,16 @@ sched->fn_counter_advance);
/* Iterate over timeslot list */ - for (i = 0; i < ARRAY_SIZE(br); i++) { + for (tn = 0; tn < ARRAY_SIZE(br); tn++) { /* Initialize the buffer for this timeslot */ - br[i] = (struct l1sched_burst_req) { + br[tn] = (struct l1sched_burst_req) { .fn = fn, - .tn = i, + .tn = tn, .burst_len = 0, /* NOPE.ind */ };
/* Timeslot is not allocated */ - ts = sched->ts[i]; + ts = sched->ts[tn]; if (ts == NULL) continue;
@@ -91,7 +91,7 @@ frame = ts->mf_layout->frames + offset;
/* Get required info from frame */ - br[i].bid = frame->ul_bid; + br[tn].bid = frame->ul_bid; chan = frame->ul_chan; handler = l1sched_lchan_desc[chan].tx_fn;
@@ -138,16 +138,16 @@ handler = l1sched_lchan_desc[L1SCHED_RACH].tx_fn;
/* Poke lchan handler */ - handler(lchan, &br[i]); + handler(lchan, &br[tn]);
/* Perform A5/X burst encryption if required */ if (lchan->a5.algo) - l1sched_a5_burst_enc(lchan, &br[i]); + l1sched_a5_burst_enc(lchan, &br[tn]); }
/* Send all bursts for this TDMA frame */ - for (i = 0; i < ARRAY_SIZE(br); i++) - l1sched_handle_burst_req(sched, &br[i]); + for (tn = 0; tn < ARRAY_SIZE(br); tn++) + l1sched_handle_burst_req(sched, &br[tn]); }
struct l1sched_state *l1sched_alloc(void *ctx, uint32_t fn_advance) @@ -171,7 +171,7 @@
void l1sched_free(struct l1sched_state *sched) { - int i; + unsigned int tn;
if (sched == NULL) return; @@ -179,8 +179,8 @@ LOGP(DSCH, LOGL_NOTICE, "Shutdown scheduler\n");
/* Free all potentially allocated timeslots */ - for (i = 0; i < ARRAY_SIZE(sched->ts); i++) - l1sched_del_ts(sched, i); + for (tn = 0; tn < ARRAY_SIZE(sched->ts); tn++) + l1sched_del_ts(sched, tn);
l1sched_clck_reset(sched); talloc_free(sched); @@ -188,7 +188,7 @@
void l1sched_reset(struct l1sched_state *sched, bool reset_clock) { - int i; + unsigned int tn;
if (sched == NULL) return; @@ -197,8 +197,8 @@ reset_clock ? "and clock counter" : "");
/* Free all potentially allocated timeslots */ - for (i = 0; i < ARRAY_SIZE(sched->ts); i++) - l1sched_del_ts(sched, i); + for (tn = 0; tn < ARRAY_SIZE(sched->ts); tn++) + l1sched_del_ts(sched, tn);
/* Stop and reset clock counter if required */ if (reset_clock)