sched: Remove the unnecessary "FAR dq_queue_t *" cast

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-08-30 09:36:44 +08:00 committed by Masayuki Ishikawa
parent a23b30d625
commit 2a981cec95
11 changed files with 25 additions and 28 deletions

View File

@ -223,8 +223,7 @@ static inline bool pg_dequeue(void)
{
/* Remove the TCB from the head of the list (if any) */
g_pftcb = (FAR struct tcb_s *)
dq_remfirst((FAR dq_queue_t *)&g_waitingforfill);
g_pftcb = (FAR struct tcb_s *)dq_remfirst(&g_waitingforfill);
pginfo("g_pftcb: %p\n", g_pftcb);
if (g_pftcb != NULL)
{

View File

@ -575,7 +575,7 @@ int nx_pthread_create(pthread_trampoline_t trampoline, FAR pthread_t *thread,
else
{
sched_unlock();
dq_rem((FAR dq_entry_t *)ptcb, (FAR dq_queue_t *)&g_inactivetasks);
dq_rem((FAR dq_entry_t *)ptcb, &g_inactivetasks);
nxsem_destroy(&pjoin->exit_sem);
errcode = EIO;

View File

@ -74,7 +74,7 @@
#define TLIST_ISINDEXED(s) ((__TLIST_ATTR(s) & TLIST_ATTR_INDEXED) != 0)
#define TLIST_ISRUNNABLE(s) ((__TLIST_ATTR(s) & TLIST_ATTR_RUNNABLE) != 0)
#define __TLIST_HEAD(s) (FAR dq_queue_t *)g_tasklisttable[s].list
#define __TLIST_HEAD(s) g_tasklisttable[s].list
#define __TLIST_HEADINDEXED(s,c) (&(__TLIST_HEAD(s))[c])
#ifdef CONFIG_SMP

View File

@ -81,14 +81,14 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb)
* g_pendingtasks task list for now.
*/
nxsched_add_prioritized(btcb, (FAR dq_queue_t *)&g_pendingtasks);
nxsched_add_prioritized(btcb, &g_pendingtasks);
btcb->task_state = TSTATE_TASK_PENDING;
ret = false;
}
/* Otherwise, add the new task to the ready-to-run task list */
else if (nxsched_add_prioritized(btcb, (FAR dq_queue_t *)&g_readytorun))
else if (nxsched_add_prioritized(btcb, &g_readytorun))
{
/* The new btcb was added at the head of the ready-to-run list. It
* is now the new active task!
@ -229,7 +229,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb)
* now.
*/
nxsched_add_prioritized(btcb, (FAR dq_queue_t *)&g_pendingtasks);
nxsched_add_prioritized(btcb, &g_pendingtasks);
btcb->task_state = TSTATE_TASK_PENDING;
doswitch = false;
}
@ -243,7 +243,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb)
* Add the task to the ready-to-run (but not running) task list
*/
nxsched_add_prioritized(btcb, (FAR dq_queue_t *)&g_readytorun);
nxsched_add_prioritized(btcb, &g_readytorun);
btcb->task_state = TSTATE_TASK_READYTORUN;
doswitch = false;
@ -263,7 +263,7 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb)
* and check if a context switch will occur
*/
tasklist = (FAR dq_queue_t *)&g_assignedtasks[cpu];
tasklist = &g_assignedtasks[cpu];
switched = nxsched_add_prioritized(btcb, tasklist);
/* If the selected task list was the g_assignedtasks[] list and if the
@ -337,12 +337,12 @@ bool nxsched_add_readytorun(FAR struct tcb_s *btcb)
if (nxsched_islocked_global())
{
next->task_state = TSTATE_TASK_PENDING;
tasklist = (FAR dq_queue_t *)&g_pendingtasks;
tasklist = &g_pendingtasks;
}
else
{
next->task_state = TSTATE_TASK_READYTORUN;
tasklist = (FAR dq_queue_t *)&g_readytorun;
tasklist = &g_readytorun;
}
nxsched_add_prioritized(next, tasklist);

View File

@ -211,8 +211,8 @@ int sched_lock(void)
* unlocked and nxsched_merge_pending() is called.
*/
nxsched_merge_prioritized((FAR dq_queue_t *)&g_readytorun,
(FAR dq_queue_t *)&g_pendingtasks,
nxsched_merge_prioritized(&g_readytorun,
&g_pendingtasks,
TSTATE_TASK_PENDING);
leave_critical_section(flags);

View File

@ -195,7 +195,7 @@ bool nxsched_merge_pending(void)
{
/* Find the CPU that is executing the lowest priority task */
ptcb = (FAR struct tcb_s *)dq_peek((FAR dq_queue_t *)&g_pendingtasks);
ptcb = (FAR struct tcb_s *)dq_peek(&g_pendingtasks);
if (ptcb == NULL)
{
/* The pending task list is empty */
@ -219,8 +219,7 @@ bool nxsched_merge_pending(void)
{
/* Remove the task from the pending task list */
tcb = (FAR struct tcb_s *)
dq_remfirst((FAR dq_queue_t *)&g_pendingtasks);
tcb = (FAR struct tcb_s *)dq_remfirst(&g_pendingtasks);
/* Add the pending task to the correct ready-to-run list. */
@ -237,8 +236,8 @@ bool nxsched_merge_pending(void)
* move them back to the pending task list.
*/
nxsched_merge_prioritized((FAR dq_queue_t *)&g_readytorun,
(FAR dq_queue_t *)&g_pendingtasks,
nxsched_merge_prioritized(&g_readytorun,
&g_pendingtasks,
TSTATE_TASK_PENDING);
/* And return with the scheduler locked and tasks in the
@ -250,8 +249,7 @@ bool nxsched_merge_pending(void)
/* Set up for the next time through the loop */
ptcb = (FAR struct tcb_s *)
dq_peek((FAR dq_queue_t *)&g_pendingtasks);
ptcb = (FAR struct tcb_s *)dq_peek(&g_pendingtasks);
if (ptcb == NULL)
{
/* The pending task list is empty */
@ -267,8 +265,8 @@ bool nxsched_merge_pending(void)
* tasks in the pending task list to the ready-to-run task list.
*/
nxsched_merge_prioritized((FAR dq_queue_t *)&g_pendingtasks,
(FAR dq_queue_t *)&g_readytorun,
nxsched_merge_prioritized(&g_pendingtasks,
&g_readytorun,
TSTATE_TASK_READYTORUN);
}

View File

@ -86,7 +86,7 @@ bool nxsched_remove_readytorun(FAR struct tcb_s *rtcb)
* is always the g_readytorun list.
*/
dq_rem((FAR dq_entry_t *)rtcb, (FAR dq_queue_t *)&g_readytorun);
dq_rem((FAR dq_entry_t *)rtcb, &g_readytorun);
/* Since the TCB is not in any list, it is now invalid */
@ -214,7 +214,7 @@ bool nxsched_remove_readytorun(FAR struct tcb_s *rtcb)
* list and add to the head of the g_assignedtasks[cpu] list.
*/
dq_rem((FAR dq_entry_t *)rtrtcb, (FAR dq_queue_t *)&g_readytorun);
dq_rem((FAR dq_entry_t *)rtrtcb, &g_readytorun);
dq_addfirst((FAR dq_entry_t *)rtrtcb, tasklist);
rtrtcb->cpu = cpu;

View File

@ -218,7 +218,7 @@ void nxtask_uninit(FAR struct task_tcb_s *tcb)
* nxtask_setup_scheduler().
*/
dq_rem((FAR dq_entry_t *)tcb, (FAR dq_queue_t *)&g_inactivetasks);
dq_rem((FAR dq_entry_t *)tcb, &g_inactivetasks);
/* Release all resources associated with the TCB... Including the TCB
* itself.

View File

@ -178,7 +178,7 @@ int nxtask_restart(pid_t pid)
/* Add the task to the inactive task list */
dq_addfirst((FAR dq_entry_t *)tcb, (FAR dq_queue_t *)&g_inactivetasks);
dq_addfirst((FAR dq_entry_t *)tcb, &g_inactivetasks);
tcb->cmn.task_state = TSTATE_TASK_INACTIVE;
#ifdef CONFIG_SMP

View File

@ -454,7 +454,7 @@ static int nxthread_setup_scheduler(FAR struct tcb_s *tcb, int priority,
/* Add the task to the inactive task list */
sched_lock();
dq_addfirst((FAR dq_entry_t *)tcb, (FAR dq_queue_t *)&g_inactivetasks);
dq_addfirst((FAR dq_entry_t *)tcb, &g_inactivetasks);
tcb->task_state = TSTATE_TASK_INACTIVE;
sched_unlock();
}

View File

@ -335,7 +335,7 @@ void nxtask_abort_vfork(FAR struct task_tcb_s *child, int errcode)
{
/* The TCB was added to the active task list by nxtask_setup_scheduler() */
dq_rem((FAR dq_entry_t *)child, (FAR dq_queue_t *)&g_inactivetasks);
dq_rem((FAR dq_entry_t *)child, &g_inactivetasks);
/* Release the TCB */