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
This commit is contained in:
parent
94bb69ab3c
commit
e1740e2fc8
|
@ -757,7 +757,7 @@ static int l1ctl_rx_tch_mode_req(struct l1ctl_link *l1l, struct msgb *msg)
|
||||||
struct l1ctl_tch_mode_req *req;
|
struct l1ctl_tch_mode_req *req;
|
||||||
struct l1sched_lchan_state *lchan;
|
struct l1sched_lchan_state *lchan;
|
||||||
struct l1sched_ts *ts;
|
struct l1sched_ts *ts;
|
||||||
int i;
|
unsigned int tn;
|
||||||
|
|
||||||
req = (struct l1ctl_tch_mode_req *) msg->l1h;
|
req = (struct l1ctl_tch_mode_req *) msg->l1h;
|
||||||
|
|
||||||
|
@ -765,9 +765,9 @@ static int l1ctl_rx_tch_mode_req(struct l1ctl_link *l1l, struct msgb *msg)
|
||||||
"(tch_mode=%u, audio_mode=%u)\n", req->tch_mode, req->audio_mode);
|
"(tch_mode=%u, audio_mode=%u)\n", req->tch_mode, req->audio_mode);
|
||||||
|
|
||||||
/* Iterate over timeslot list */
|
/* 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 */
|
/* Timeslot is not allocated */
|
||||||
ts = l1l->sched->ts[i];
|
ts = l1l->sched->ts[tn];
|
||||||
if (ts == NULL)
|
if (ts == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ static void sched_frame_clck_cb(struct l1sched_state *sched)
|
||||||
enum l1sched_lchan_type chan;
|
enum l1sched_lchan_type chan;
|
||||||
uint8_t offset;
|
uint8_t offset;
|
||||||
struct l1sched_ts *ts;
|
struct l1sched_ts *ts;
|
||||||
int i;
|
unsigned int tn;
|
||||||
|
|
||||||
/* Advance TDMA frame number in order to give the transceiver
|
/* Advance TDMA frame number in order to give the transceiver
|
||||||
* more time to handle the burst before the actual transmission. */
|
* more time to handle the burst before the actual transmission. */
|
||||||
|
@ -69,16 +69,16 @@ static void sched_frame_clck_cb(struct l1sched_state *sched)
|
||||||
sched->fn_counter_advance);
|
sched->fn_counter_advance);
|
||||||
|
|
||||||
/* Iterate over timeslot list */
|
/* 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 */
|
/* Initialize the buffer for this timeslot */
|
||||||
br[i] = (struct l1sched_burst_req) {
|
br[tn] = (struct l1sched_burst_req) {
|
||||||
.fn = fn,
|
.fn = fn,
|
||||||
.tn = i,
|
.tn = tn,
|
||||||
.burst_len = 0, /* NOPE.ind */
|
.burst_len = 0, /* NOPE.ind */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Timeslot is not allocated */
|
/* Timeslot is not allocated */
|
||||||
ts = sched->ts[i];
|
ts = sched->ts[tn];
|
||||||
if (ts == NULL)
|
if (ts == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ static void sched_frame_clck_cb(struct l1sched_state *sched)
|
||||||
frame = ts->mf_layout->frames + offset;
|
frame = ts->mf_layout->frames + offset;
|
||||||
|
|
||||||
/* Get required info from frame */
|
/* Get required info from frame */
|
||||||
br[i].bid = frame->ul_bid;
|
br[tn].bid = frame->ul_bid;
|
||||||
chan = frame->ul_chan;
|
chan = frame->ul_chan;
|
||||||
handler = l1sched_lchan_desc[chan].tx_fn;
|
handler = l1sched_lchan_desc[chan].tx_fn;
|
||||||
|
|
||||||
|
@ -138,16 +138,16 @@ static void sched_frame_clck_cb(struct l1sched_state *sched)
|
||||||
handler = l1sched_lchan_desc[L1SCHED_RACH].tx_fn;
|
handler = l1sched_lchan_desc[L1SCHED_RACH].tx_fn;
|
||||||
|
|
||||||
/* Poke lchan handler */
|
/* Poke lchan handler */
|
||||||
handler(lchan, &br[i]);
|
handler(lchan, &br[tn]);
|
||||||
|
|
||||||
/* Perform A5/X burst encryption if required */
|
/* Perform A5/X burst encryption if required */
|
||||||
if (lchan->a5.algo)
|
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 */
|
/* Send all bursts for this TDMA frame */
|
||||||
for (i = 0; i < ARRAY_SIZE(br); i++)
|
for (tn = 0; tn < ARRAY_SIZE(br); tn++)
|
||||||
l1sched_handle_burst_req(sched, &br[i]);
|
l1sched_handle_burst_req(sched, &br[tn]);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct l1sched_state *l1sched_alloc(void *ctx, uint32_t fn_advance)
|
struct l1sched_state *l1sched_alloc(void *ctx, uint32_t fn_advance)
|
||||||
|
@ -171,7 +171,7 @@ struct l1sched_state *l1sched_alloc(void *ctx, uint32_t fn_advance)
|
||||||
|
|
||||||
void l1sched_free(struct l1sched_state *sched)
|
void l1sched_free(struct l1sched_state *sched)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int tn;
|
||||||
|
|
||||||
if (sched == NULL)
|
if (sched == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -179,8 +179,8 @@ void l1sched_free(struct l1sched_state *sched)
|
||||||
LOGP(DSCH, LOGL_NOTICE, "Shutdown scheduler\n");
|
LOGP(DSCH, LOGL_NOTICE, "Shutdown scheduler\n");
|
||||||
|
|
||||||
/* Free all potentially allocated timeslots */
|
/* Free all potentially allocated timeslots */
|
||||||
for (i = 0; i < ARRAY_SIZE(sched->ts); i++)
|
for (tn = 0; tn < ARRAY_SIZE(sched->ts); tn++)
|
||||||
l1sched_del_ts(sched, i);
|
l1sched_del_ts(sched, tn);
|
||||||
|
|
||||||
l1sched_clck_reset(sched);
|
l1sched_clck_reset(sched);
|
||||||
talloc_free(sched);
|
talloc_free(sched);
|
||||||
|
@ -188,7 +188,7 @@ void l1sched_free(struct l1sched_state *sched)
|
||||||
|
|
||||||
void l1sched_reset(struct l1sched_state *sched, bool reset_clock)
|
void l1sched_reset(struct l1sched_state *sched, bool reset_clock)
|
||||||
{
|
{
|
||||||
int i;
|
unsigned int tn;
|
||||||
|
|
||||||
if (sched == NULL)
|
if (sched == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -197,8 +197,8 @@ void l1sched_reset(struct l1sched_state *sched, bool reset_clock)
|
||||||
reset_clock ? "and clock counter" : "");
|
reset_clock ? "and clock counter" : "");
|
||||||
|
|
||||||
/* Free all potentially allocated timeslots */
|
/* Free all potentially allocated timeslots */
|
||||||
for (i = 0; i < ARRAY_SIZE(sched->ts); i++)
|
for (tn = 0; tn < ARRAY_SIZE(sched->ts); tn++)
|
||||||
l1sched_del_ts(sched, i);
|
l1sched_del_ts(sched, tn);
|
||||||
|
|
||||||
/* Stop and reset clock counter if required */
|
/* Stop and reset clock counter if required */
|
||||||
if (reset_clock)
|
if (reset_clock)
|
||||||
|
|
Loading…
Reference in New Issue