sched: Convert code handling next_list array to be size independant

Change-Id: Id209fe66f85501437a79f7ca0c8e3cf816177611
This commit is contained in:
Pau Espin Pedrol 2020-12-15 18:55:16 +01:00 committed by pespin
parent b77a2c992e
commit d6b913fc39
1 changed files with 5 additions and 6 deletions

View File

@ -164,16 +164,16 @@ static struct msgb *sched_select_ctrl_msg(
{
struct msgb *msg = NULL;
struct gprs_rlcmac_tbf *tbf = NULL;
struct gprs_rlcmac_tbf *next_list[3] = { tbfs->ul_ass,
tbfs->dl_ass,
tbfs->ul_ack };
struct gprs_rlcmac_tbf *next_list[] = { tbfs->ul_ass,
tbfs->dl_ass,
tbfs->ul_ack };
/* Send Packet Application Information first (ETWS primary notifications) */
msg = sched_app_info(tbfs->dl_ass);
if (!msg) {
for (size_t i = 0; i < ARRAY_SIZE(next_list); ++i) {
tbf = next_list[(pdch->next_ctrl_prio + i) % 3];
tbf = next_list[(pdch->next_ctrl_prio + i) % ARRAY_SIZE(next_list)];
if (!tbf)
continue;
@ -201,8 +201,7 @@ static struct msgb *sched_select_ctrl_msg(
continue;
}
pdch->next_ctrl_prio += 1;
pdch->next_ctrl_prio %= 3;
pdch->next_ctrl_prio = (pdch->next_ctrl_prio + 1) % ARRAY_SIZE(next_list);
break;
}
}